SCHED_FIFO和SCHED_RR是如何进行互连的?

时间:2021-01-23 02:12:42

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?

SCHED_FIFO和SCHED_RR都用于实时应用。我知道SCHED_RR可以被时间分段抢占。但是,假设我有一个线程被设置为SCHED_FIFO,而另一个线程被设置为SCHED_RR,如果这两个线程都准备运行,它们是否完全按优先级安排?如果他们有同样的优先权呢?

1 个解决方案

#1


2  

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.

概念上,有一个与每个静态优先级级别相关联的可运行进程的列表。这些列表可以包含SCHED_FIFO和SCHED_RR进程——这两个调度策略共享同一组静态优先级。

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.

调度策略影响进程在这些列表中的移动方式。对于SCHED_FIFO,一旦进程到达给定优先级的列表头,它将一直保持在那里,直到阻塞或产生。对于SCHED_RR,已超过其最大时间量的可运行进程将被移动到列表的末尾,作为其静态优先级。

#1


2  

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.

概念上,有一个与每个静态优先级级别相关联的可运行进程的列表。这些列表可以包含SCHED_FIFO和SCHED_RR进程——这两个调度策略共享同一组静态优先级。

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.

调度策略影响进程在这些列表中的移动方式。对于SCHED_FIFO,一旦进程到达给定优先级的列表头,它将一直保持在那里,直到阻塞或产生。对于SCHED_RR,已超过其最大时间量的可运行进程将被移动到列表的末尾,作为其静态优先级。