Re: General kernel question about waiting for events

From: Alan Cox
Date: Tue Dec 01 2009 - 19:22:28 EST


> In that case, wrapped in different packages, it always ends with
> following loop:
>
> while( event == false )
> schedule();

No. If it were to do that then real time processes could spin eating the
CPU forever.

There is a difference between rescheduling and sleeping for an event.
Sleeping for an event (ie on a waitqueue) means that you will not be
woken until the wait queue is woken (or certain other things like signals
if interruptible). Rescheduling gives the CPU to someone else if anyone
wants it.

In short the different task states that are set are the important bit to
look at to understand this further.
--
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/