Linux Scheduling Real-Time

chrt — manipulate real-time scheduling attributes

chrt sets or retrieves the scheduling policy and priority of a process. It is the modern tool for managing SCHED_FIFO, SCHED_RR, and normal scheduling.

10 Practical Examples

1) Show scheduling policy of a PID

chrt -p <PID>

2) Start command with SCHED_RR priority 10

sudo chrt -r 10 ./app

3) Start command with SCHED_FIFO priority 20

sudo chrt -f 20 ./app

4) Change policy of running process

sudo chrt -r -p 15 <PID>

5) Return to normal scheduling

sudo chrt -o -p 0 <PID>

6) Show maximum RT priority

chrt --max

7) Compare multiple processes

chrt -p <PID1> <PID2>

8) Combine with taskset

sudo taskset -c 2 chrt -r 10 ./app

9) Inspect scheduling via ps

ps -eo pid,cls,rtprio,pri,nice,cmd

10) Check systemd service RT limits

systemctl show yourservice | grep -i rt

Notes & Gotchas