chrt(1)
Run processes with a specified CPU scheduling class and priority, or change scheduling parameters of running processes.
Synopsis
chrt [OPTION]... [-p PID | COMMAND [ARG]...]Description
chrt sets or retrieves the real-time scheduling attributes of a process. It allows you to assign different scheduling classes (SCHED_OTHER, SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_IDLE) and priority levels to new or existing processes. Higher priority real-time processes preempt lower-priority ones, making chrt essential for latency-sensitive applications.
When used with -p PID, chrt modifies an already-running process. Without -p, it launches a new command with the specified scheduling parameters. Requires appropriate privileges (usually root) to set real-time scheduling classes.
Common options
| Flag | What it does |
|---|---|
-p, --pid | Operate on existing process with given PID instead of launching new command |
-f, --fifo | Set SCHED_FIFO (first-in, first-out real-time) scheduling class |
-r, --rr | Set SCHED_RR (round-robin real-time) scheduling class |
-o, --other | Set SCHED_OTHER (default, time-sharing) scheduling class |
-b, --batch | Set SCHED_BATCH (background batch) scheduling class |
-i, --idle | Set SCHED_IDLE (very low priority idle) scheduling class |
-d, --deadline | Set SCHED_DEADLINE (deadline-based) scheduling class |
-T, --sched-runtime=NS | Set runtime for SCHED_DEADLINE in nanoseconds |
-P, --sched-period=NS | Set period for SCHED_DEADLINE in nanoseconds |
-v, --verbose | Display current scheduling class and priority after modification |
-a, --all-tasks | Operate on all tasks (threads) of a process when used with -p |
-m, --max | Show minimum and maximum valid priorities for specified scheduling class |
Examples
Launch myapp with SCHED_FIFO class at priority 99 (highest real-time priority)
chrt -f 99 ./myappChange existing process 1234 to SCHED_RR (default) with priority 50
chrt -p 50 1234Set current shell process to SCHED_FIFO priority 80
chrt -f -p 80 $$Show minimum and maximum priority values for SCHED_FIFO class
chrt -m -fRun background_task with SCHED_BATCH at lowest priority and reduced CPU share
chrt -b 0 nice -n 10 ./background_taskChange process 5678 to SCHED_RR priority 30 and display the updated settings
chrt -v -r -p 30 5678Reset process 2000 back to standard SCHED_OTHER (non-real-time) scheduling
chrt -o -p 0 2000Apply SCHED_FIFO priority 60 to all threads of multi-threaded process 3000
chrt -a -f -p 60 3000