I have a Linux system where we have used cgroups to create two cpu_exclusive cpusets, A and B, and where we have migrated all user threads and all unbound kernel threads to a cgroup attached to cpuset A. Things running in cpuset A have varying scheduler policies and varying priorities, and there are many more threads running in cpuset A than there are cores in cpuset A.

There is also some small number of very active processes attached to cpuset B, where the total number of user threads across these processes is never greater than the number of cores exclusively available in cpuset B. The goal is to shield these important tasks running in cpuset B from other activity on the machine and to minimize processing latency.

In such a setup, does the scheduling policy/priority of the user threads running in cpuset B have any observable effect? Stated differently: would changing the scheduling policy of the B cpuset threads from the default SCHED_OTHER to SCHED_FIFO or SCHED_RR have any consequences, good or bad?

It seems like the answer should be 'no', since the scheduler should be able to assign each thread running in cpuset B its own dedicated core, so there would be nothing to prioritize or schedule, and so the policy and relative priority of the B cpuset threads wouldn't matter. On the other hand, there are the bound kernel threads and the 'scheduler domain' aspects to worry about, and probably other things I have not considered.

Do the scheduling policies and priorities of threads running in an overprovisioned exclusive cpuset matter in any practical sense?

2 Answers 2


The time slice used will matter for CPU intensive jobs that require cache persistence, unless you lock a particular core to each PID. You can increase the time slice with scheduler policy SCHED_BATCH and improve performance up to 300% in some cases, while reducing interactive responsiveness. The opposite effect of smaller time slices occurs with SCHED_RR (which will reduce throughput but increase real time responsiveness).

You can use schedtool to set the policy of specific PIDs for all PIDs in set B as a single command. It can also be used to lock specific PIDs to specific cores, which would be the optimal solution since then cache persistence no longer depends on the time slice, but this takes more effort since you have to run a separate schedtool command for each PID.

  • RR timeslice size can be manually changed. fifo and rr also work within a setting for period and proportion, the default is 1 second and .95 seconds. That is fifo or RR will be given a 0.95s block of every 1s and other stuff like kernel tasks get 0.05s/1s. These can be modified to 1/1 to create an infinite time block. (Actual setting is in µs) Hardware Irq have static priority 50 so setting fifo 1/1 and priority of 50 or more should be used with caution, esp. if a core isn't explicitly reserved for management tasks, you can create a process that won't yield for anything. Over 10 years later
    – Max Power
    Commented Jan 7 at 1:39

If each process has its own core then there's no priority constraints.

However, if you schedule a process which takes 30 minutes to run every 15 minutes, you will start to have a need to prioritize as the process will start overlapping.

There's no "best" scheduling policy however.

They really depend on what you want to achieve. But in the beginning, I would leave it to SCHED_OTHER, the default and observe for some time before I try more specialize stuff.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .