1

I have an exam and there is a huge confusion which I need to fix.

I know that 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.

Plus, I know that if there is a real-time process in the system no "regular" process will run.

But what I can't understand how RR and FIFO will run together?

Let's say I have the following processes all with same priority, while (f) means it's FIFO and (r) means RR ordered from the one which came first to the latest:

A(r), B(f), C(f), D(r), E(r)

  1. In which order will they run?

  2. What if I change A to (f)?

  3. Now what if I have two processes A and B where A came before B and A is RR while B is FIFO what's the order?

  4. What if A is FIFO not and B is RR?

I other words, I don't know what's more important when we have RR and FIFO together, is it who came first, is it who has more priority or is it always FIFO?

James Z
  • 12,209
  • 10
  • 24
  • 44
algo
  • 101
  • 6
  • Mostly guesses, so not an answer. As I understand, the only difference between a `SCHED_FIFO` and `SCHED_RR` thread is that a `SCHED_FIFO` thread will keep running unless it yields, is blocked, or is preempted by a higher priority thread, where a `SCHED_RR` thread will eventually run out of time. Logically, for 3, thread A would run until its time slice ends, at which point B will run until it yields. – Hasturkun Oct 13 '21 at 11:21

1 Answers1

0

According to the Red Hat Reference Guide Chapter 5. Priorities and Policies:

Generally, SCHED_FIFO is preferred over SCHED_RR.

I think FIFO would come first when we have both runnable FIFO and RR in the same static priority list.

Evan
  • 430
  • 6
  • 16