February 2020
Intermediate to advanced
292 pages
8h 54m
English
The POSIX standard defines the following policies:
Here, SCHED_OTHER is the default one and SCHED_FIFO and SCHED_RR are the real-time ones. Actually, Linux defines SCHED_NORMAL, SCHED_BATCH, and SCHED_IDLE as other real-time policies. These are defined in the sched.h header file.
Step 1 calls sched_getscheduler() to check the current policy of the process. As expected, the default is SCHED_OTHER. We passed the input to the getpid() function (<unistd.h>), which returns the PID of the current process. sched_getscheduler() also accepts 0, which in this case represents the current process.
Step ...
Read now
Unlock full access