Red Hat Bugzilla – Bug 103189
SETSCHEDULER man page is unclear about FIFO scheduling
Last modified: 2007-04-18 12:57:10 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.5a) Gecko/20030801
Description of problem:
The man page for sched_setscheduler is unclear as to how a running SCHED_FIFO'd
process responds when a process which has also been SCHED_FIFO'd of the same
priority comes along.
The man page contains the following description:
"When a SCHED_FIFO process becomes runnable, it will be inserted at the end of
the list for its priority. A call to sched_setscheduler or sched_setparam
will put the SCHED_FIFO (or SCHED_RR) process identified by pid at the
start of the list if it was runnable. As a consequence, it may preempt the
currently running process if it has the same priority."
Later it goes on to say:
"A SCHED_FIFO process runs until either it is blocked by an I/O request, it is
preempted by a higher priority process, or it calls sched_yield."
As such it is not wholely clear what happens if I set up one process with a
scheduler of SCHED_FIFO and another process with the same scheduler priority
also with SCHED_FIFO. Does the second preempt the first (as the first quote
suggests) or does the second remained queued until the first blocks or yields
(as the second quote suggests)? Does preemption only happen when the scheduler
for the the second process is changed?
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. man sched_setscheduler
2. Read the chapter titled SCHED_FIFO: First In-First Out scheduling
3. Try to work out whehther a a running SCHED_FIFO task will be preempted by
another SCHED_FIFO task of the same priority and if so when it will happen.
Actual Results: !cONFusioN
Expected Results: Clarity.
According to man-pages-1.66, the sentence in between your two
sentences says "No other events will move a process scheduled ... in
the wait list ... with equal static priority." and it says that POSIX
1003.1 says the process with go to the end of the list. So the answer
is no, it will no be pre-empted if you later add a process of the same
priority, which goes to the bottom of the list.