Re: Why 'wait queues' and not 'channels'

David S. Miller (davem@redhat.com)
Sun, 16 May 1999 03:10:13 -0700


Date: Sat, 15 May 1999 20:58:17 +0200 (MET DST)
From: Gerard Roudier <groudier@club-internet.fr>

Linux waits on 'wait queues' but other UNIXes sleep on 'channels'.

What is better with wait queues?

Believe me when I say that we don't want the traditional sleeping
methodology of "UNIX" in any way shape or form.

As far as I know, only Plan9 and Linux get the sleeping method correct
(someone please correct me if some other OS does things this way as
well).

Essentially the crucial difference is, under Linux we:

add_to_wait_queue
while(1) {
check event, break if event happened
break if signal arrived
schedule();
}
remove_from_wait_queue

On first sight, you may think nothing interesting is happening here.

Think harder, the issue is that we eliminate completely any races
between the adding to wait queue and test of the event. The task
himself controls completely his existence on the wait queue.

Other systems have a more complex issue about avoiding the race
between the test and the sleep (especially on SMP) because they have
only a "add to wait queue and schedule()" singular interface.

I suggest not changing the wait queue architecture we have, it's done
right and cleanly.

Later,
David S. Miller
davem@redhat.com

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