Re: [take25 1/6] kevent: Description.

From: Hans Henrik Happe
Date: Thu Nov 23 2006 - 19:17:48 EST


On Thursday 23 November 2006 23:48, Jeff Garzik wrote:
> I'm really wondering is designing for N-threads-to-1-ring is the wisest
> choice?
>
> Considering current designs, it seems more likely that a single thread
> polls for socket activity, then dispatches work. How often do you
> really see in userland multiple threads polling the same set of fds,
> then fighting to decide who will handle raised events?

They should not fight, but gently divide event handling work.

> More likely, you will see "prefork" (start N threads, each with its own
> ring)

One ring could be more busy than others, leaving all the work to one thread.

> or a worker pool (single thread receives events, then dispatches
> to multiple threads for execution) or even one-thread-per-fd (single
> thread receives events, then starts new thread for handling).

This is more like fighting :-)
It adds context switches and therefore extra latency for event handling.

> If you have multiple threads accessing the same ring -- a poor design
> choice -- I would think the burden should be on the application, to
> provide proper synchronization.

Comming from the HPC world I do not agree. Context switches should be avoided.
This paper is a good example from the HPC world:

http://cobweb.ecn.purdue.edu/~vpai/Publications/majumder-lacsi04.pdf.

The latency problems introduced by context switches in this work calls for
even more functionality in event handling. I will not go into details now.
There are enough problems with kevent's current feature set and I believe
these extra features can be added later without breaking the API.

--

Hans Henrik Happe
-
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/