Querying a given thread’s scheduling policy and priority
In this section, you’ll learn how to query the scheduling policy and priority of any given thread on the system via the command line. (But what about programmatically querying and setting the same? We defer that discussion to Chapter 11, The CPU Scheduler – Part 2, in the Querying and setting a thread’s scheduling policy and priority section.)
We learned that, on Linux, the thread is the KSE; it’s what gets scheduled and runs on the processor. Also, Linux has several choices for the scheduling policy (or algorithm) to use. Both the scheduling policy and priority is assigned on a per-thread basis, with the default policy always being SCHED_OTHER
and the default real-time priority being 0
(in other words, it’s a non-real-time thread; see Table 10.1).
On a given Linux system, we can always see all processes alive (via a simple ps -A
), or, with GNU ps
, even every thread alive (one...