The Linux scheduler offers different policies for allocating processor time to tasks. The Learning to set and get a scheduler policy recipe shows what policies are available and how to change them. The SCHED_RR policy, that is, the round-robin policy, is the one that's used on real-time tasks (with SCHED_FIFO). The SCHED_RR policy assigns a timeslice to each process. This recipe will show you how to configure the timeslice.
Learning to get the timeslice value
How to do it...
In this recipe, we'll be writing a small program to get the round-robin timeslice by using the sched_rr_get_interval() function:
- On a new shell, open a new file called schedGetInterval.cpp. We have to include <sched...