Re: A question about behavior of SCHED_FIFO: Only one process inrun queue at any time.

From: Steven Rostedt
Date: Sat Jun 24 2006 - 08:30:23 EST



On Sat, 24 Jun 2006, [BIG5] ³\¬¥»¨ wrote:

>
> I have read some textbook about OS and Linux kernel, according to these books,
> SCHED_FIFO is a real-time scheduling policy, and when a process is a SCHED_FIFO
> process, it will be preempted only when follwing case happend:
>
> 1.There are some process with higher priority.
> 2.The process is in blocking opreation.
> 3.The process is dead.
> 4.sched_yield()

That all sounds right.

>
> Man page of sched_setscheduler even says:"SCHED_FIFO is a simple
> scheduling algorithm without time slicing."

Correct.

>
> Then I worte an user space program (in the attachment),
> which fork an SCHED_FIFO child process, it does nothing expect an infinite loop
> and print something on screen.

How did you run more than one SCHED_FIFO process? If you are not on a SMP
machine, as soon as you run 1 of these children, it will run to completion
because it is higher priority than any other process. So the next
child you run will run after that.

>
> Here is the dmesg result, it is clearly these process is in the same
> queue, and there
> is only one process in the queue at any time point.
>
> RT-Queue[1]:P[9822] ->
> RT-Queue[1]:P[9822] ->
> RT-Queue[1]:P[9810] ->
> RT-Queue[1]:P[9810] ->
> RT-Queue[1]:P[9816] ->
> RT-Queue[1]:P[9816] ->
> RT-Queue[1]:P[9822] ->
> RT-Queue[1]:P[9822] ->
>
> Did I misunderstand about SCHED_FIFO policy?
>

No, but I still don't know how you ran all of them.

-- Steve

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/