🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

⚙️ Process Management April 4, 2026 15

Linux Command: chrt

Set or get real-time scheduling attributes

Terminal — Process Management
Command
$ chrt -p $(pgrep -f postgres)
Output
pid 1234's current scheduling policy: SCHED_OTHER pid 1234's current scheduling priority: 0

The chrt command sets and retrieves the real-time scheduling policy and priority of processes. Linux supports several CPU scheduling policies: SCHED_OTHER (default, time-sharing), SCHED_FIFO (real-time, first-in-first-out), SCHED_RR (real-time, round-robin), SCHED_BATCH (batch processing), SCHED_IDLE (very low priority), and SCHED_DEADLINE (deadline-based scheduling). Real-time scheduling policies (FIFO and RR) guarantee that processes run with minimal latency — they will always preempt normal processes. This is critical for audio/video processing, industrial control systems, financial trading applications, and any workload requiring deterministic timing. chrt is used by system administrators and developers to optimize process scheduling for specific workloads. For example, setting a database process to SCHED_RR ensures it gets CPU time even when the system is under heavy load, reducing query latency spikes.

Syntax

chrt [OPTIONS] [POLICY] PRIORITY COMMAND [ARGS]\nchrt [OPTIONS] -p [PRIORITY] PID

Key Options

  • -p PID — Get or set scheduling of running process
  • -f — Set SCHED_FIFO policy (real-time)
  • -r — Set SCHED_RR policy (real-time, round-robin)
  • -o — Set SCHED_OTHER policy (normal/default)
  • -b — Set SCHED_BATCH policy (batch processing)
  • -i — Set SCHED_IDLE policy (lowest priority)

Examples

Check process scheduling

chrt -p $(pgrep -f postgres)

Output: pid 1234's current scheduling policy: SCHED_OTHER pid 1234's current scheduling priority: 0

Run with real-time priority

sudo chrt -f 50 ./audio-processor

Set running process to real-time

sudo chrt -r -p 30 $(pgrep -f myapp)

Pro Tips

  • A SCHED_FIFO process with high priority that never yields CPU can make the system unresponsive. Always test with lower priorities first. Use SCHED_RR for time-sliced real-time.
  • Avoid priority 99 — it is used by critical kernel threads (watchdog, migration). Use 1-98 for user processes. Priority 50 is a good starting point.
  • Setting SCHED_FIFO or SCHED_RR requires root (or CAP_SYS_NICE capability). SCHED_BATCH and SCHED_IDLE can be set by regular users for their own processes.

Learn more: Full chrt reference →

Share this tip