$linuxjunkies
>

chrt(1)

Run processes with a specified CPU scheduling class and priority, or change scheduling parameters of running processes.

UbuntuDebianFedoraArch

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

FlagWhat it does
-p, --pidOperate on existing process with given PID instead of launching new command
-f, --fifoSet SCHED_FIFO (first-in, first-out real-time) scheduling class
-r, --rrSet SCHED_RR (round-robin real-time) scheduling class
-o, --otherSet SCHED_OTHER (default, time-sharing) scheduling class
-b, --batchSet SCHED_BATCH (background batch) scheduling class
-i, --idleSet SCHED_IDLE (very low priority idle) scheduling class
-d, --deadlineSet SCHED_DEADLINE (deadline-based) scheduling class
-T, --sched-runtime=NSSet runtime for SCHED_DEADLINE in nanoseconds
-P, --sched-period=NSSet period for SCHED_DEADLINE in nanoseconds
-v, --verboseDisplay current scheduling class and priority after modification
-a, --all-tasksOperate on all tasks (threads) of a process when used with -p
-m, --maxShow 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 ./myapp

Change existing process 1234 to SCHED_RR (default) with priority 50

chrt -p 50 1234

Set current shell process to SCHED_FIFO priority 80

chrt -f -p 80 $$

Show minimum and maximum priority values for SCHED_FIFO class

chrt -m -f

Run background_task with SCHED_BATCH at lowest priority and reduced CPU share

chrt -b 0 nice -n 10 ./background_task

Change process 5678 to SCHED_RR priority 30 and display the updated settings

chrt -v -r -p 30 5678

Reset process 2000 back to standard SCHED_OTHER (non-real-time) scheduling

chrt -o -p 0 2000

Apply SCHED_FIFO priority 60 to all threads of multi-threaded process 3000

chrt -a -f -p 60 3000

Related commands