Search code examples
linuxkernelschedulerblocking

Is SCHED_FIFO thread rescheduled to the end of a list after sleeping


As the sched(7) man page says:

  1. When a blocked SCHED_FIFO thread becomes runnable, it will be inserted at the end of the list for its priority.

But officially there is no blocked state of a thread - there are only Interruptible Sleep (S) and Uninterruptible Sleep (D).

Questions:

  1. If a thread is sleeping on select(2) or clock_nanosleep(2), is that the Interruptible Sleep (both can be woken up on a signal)? I assume probably yes for both.
  2. After Interruptible Sleep, is the thread placed at the end of the scheduling list?
  3. The same as 2. but for Uninterruptible Sleep?

I think that answer to all of the questions is "Yes" but I have to be sure.


Solution

  • It is either in a Runnable state or in the one of the Sleep states (i.e. blocked)

    So you are right that the two syscalls can be interrupted by a signal, such that both are Interruptible sleep