Chapter 36. Setting the priority for a process with the chrt utility
You can set the priority for a process using the chrt
utility.
Prerequisites
- You have administrator privileges.
36.1. Setting the process priority using the chrt utility
The chrt
utility checks and adjusts scheduler policies and priorities. It can start new processes with the desired properties, or change the properties of a running process.
Procedure
To set the scheduling policy of a process, run the
chrt
command with the appropriate command options and parameters. In the following example, the process ID affected by the command is1000
, and the priority (-p
) is50
.# chrt -f -p 50 1000
To start an application with a specified scheduling policy and priority, add the name of the application, and the path to it, if necessary, along with the attributes.
# chrt -r -p 50 /bin/my-app
For more information on the
chrt
utility options, see The chrt utility options.
36.2. The chrt utility options
The chrt
utility options include command options and parameters specifying the process and priority for the command.
Policy options
- -f
-
Sets the scheduler policy to
SCHED_FIFO
. - -o
-
Sets the scheduler policy to
SCHED_OTHER
. - -r
-
Sets the scheduler policy to
SCHED_RR
(round robin). - -d
-
Sets the scheduler policy to
SCHED_DEADLINE
. - -p n
Sets the priority of the process to n.
When setting a process to SCHED_DEADLINE, you must specify the
runtime
,deadline
, andperiod
parameters.For example:
# chrt -d --sched-runtime 5000000 --sched-deadline 10000000 --sched-period 16666666 0 video_processing_tool
where
-
--sched-runtime 5000000
is the run time in nanoseconds. -
--sched-deadline 10000000
is the relative deadline in nanoseconds. -
--sched-period 16666666
is the period in nanoseconds. -
0
is a placeholder for unused priority required by thechrt
command.
-
36.3. Additional resources
-
chrt(1)
man page