Fundamentals 4 min read

Master Linux Scheduling: Real‑Time, Normal, Batch & Idle Policies Explained

This article explains Linux's real‑time and general scheduling policies—including SCHED_RR, SCHED_FIFO, SCHED_NORMAL, SCHED_BATCH, and SCHED_IDLE—describes their behavior, and demonstrates their impact on CPU allocation through practical chrt command tests.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux Scheduling: Real‑Time, Normal, Batch & Idle Policies Explained

Linux provides several scheduling policies for both real‑time and non‑real‑time processes. The real‑time policies include SCHED_RR (round‑robin, each process gets a maximum CPU time slice) and SCHED_FIFO (first‑in‑first‑out, a process runs until it blocks, yields, or is pre‑empted by a higher‑priority task).

SCHED_NORMAL is the default policy for regular processes, implementing a standard round‑robin algorithm. SCHED_BATCH is tuned for batch jobs such as data compression; it avoids pre‑emption to improve cache usage. SCHED_IDLE is for very low‑priority tasks (nice value less than 19).

Example commands to inspect the system: lscpu Sample output shows a dual‑CPU x86_64 system with two sockets, each with one core.

Testing the policies with chrt:

# chrt -f 10 top
# chrt -f 1 md5sum /dev/zero &
# chrt -r 1 sha1sum /dev/zero

Observations: the md5sum process run with SCHED_FIFO (priority 1) consistently occupied the CPU ahead of top. When using the round‑robin policy ( SCHED_RR) for sha1sum, the process was not visible in top, indicating it was not scheduled as aggressively.

These experiments demonstrate how different scheduling classes affect CPU allocation and process visibility.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxSchedulingSystem AdministrationSCHED_FIFOSCHED_RR
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.