$linuxjunkies
>

realtime scheduling

also: SCHED_FIFO, SCHED_RR, realtime process, RT scheduling

A scheduling mode that prioritizes urgent tasks to run immediately with minimal delay, guaranteeing they meet strict time deadlines. Linux provides realtime scheduling classes for tasks requiring predictable, low-latency execution.

Realtime scheduling allows tasks to run with guaranteed timing behavior, essential for applications that must respond to events within strict time windows. Linux offers two realtime scheduling policies: SCHED_FIFO (first-in-first-out) runs tasks to completion before switching, while SCHED_RR (round-robin) gives each task a fixed time slice.

Realtime tasks have higher priority than normal tasks and preempt them immediately. A realtime task can only be interrupted by a higher-priority realtime task or kernel operations. For example, an industrial control system reading sensor data must process it within microseconds—regular scheduling could introduce unpredictable delays.

Realtime scheduling requires elevated privileges (root access or the CAP_SYS_NICE capability). Use chrt to check or modify a process's scheduling class: chrt -p 1234 shows the current policy, while chrt -f 50 ./myapp runs a program with FIFO realtime priority 50.

Note: Linux realtime scheduling is soft realtime—it aims for predictable timing but doesn't guarantee it. Hard realtime requirements (aerospace, medical devices) typically need specialized kernels like PREEMPT_RT or dedicated RTOS platforms.

Related terms