Peeking at the scheduling policy and priority

Linux provides the chrt(1) utility to view and change a thread's (or process) real-time scheduling policy and priority. A quick demonstration of using it to display the scheduling policy and priority of a given process (by PID) can be seen in the following code:

$ chrt -p $$pid 1618's current scheduling policy: SCHED_OTHERpid 1618's current scheduling priority: 0$ 

In the preceding, we have queried the scheduling policy and priority of the chrt(1) process itself (with the shell's $$ variable). Try this for other threads; you will notice the policy is (almost) always SCHED_OTHER and that the real-time priority is zero. A real-time priority of zero implies that the process is not real time.

You ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.