Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does SCHED_FIFO and SCHED_RR interfer with each other?

SCHED_FIFO and SCHED_RR are both meant for real-time uses. I am aware that SCHED_RR can be preempted by time slicing. But say if I have one thread set to SCHED_FIFO, and another set to SCHED_RR, if both threads are ready to run, are they scheduled purely by priority? What if they have same priority?

like image 893
wei Avatar asked Dec 03 '12 04:12

wei


People also ask

What is the difference between Sched_rr round robin and SCHED_FIFO?

The difference between SCHED_FIFO and SCHED_RR is that among tasks with the same priority, SCHED_RR performs a round-robin with a certain timeslice; SCHED_FIFO, instead, needs the task to explicitly yield the processor.

What is Sched_batch?

SCHED_BATCH: Scheduling batch processes (Since Linux 2.6. 16.) SCHED_BATCH can be used only at static priority 0. This policy is similar to SCHED_OTHER in that it schedules the thread according to its dynamic priority (based on the nice value).

What is Sched_normal?

SCHED_OTHER or SCHED_NORMAL is the default scheduling policy for Linux threads. It has a dynamic priority that is changed by the system based on the characteristics of the thread. Another thing that effects the priority of SCHED_OTHER threads is their nice value.

How do I change scheduling policy in Linux?

Change Scheduling Policy “SCHED_FIFO” with Priority To change the scheduling policy of a process and set its priority level, execute the below-mentioned option with the chart command. For example, the current schedule of the program is “Sched_Batch” and we want to change it to “Sched_Fifo”.


1 Answers

Conceptually, there is a list of runnable processes associated with each static priority level. These lists can contain both SCHED_FIFO and SCHED_RR processes - the two scheduling policies share the same set of static priorities.

When selecting a process to run, the scheduler takes the process at the head of the non-empty list with the highest static priority, regardless of the scheduling policy of that process.

The scheduling policies affect how the processes move within those lists. For SCHED_FIFO, once a process reaches the head of the list for a given priority it will stay there until it blocks or yields. For SCHED_RR, a runnable process that has exceeded its maximum time quantum will be moved to the end of the list for its static priority.

like image 106
caf Avatar answered Oct 05 '22 13:10

caf