Thread-based or event-based?
Posted Mar 4, 2007 18:55 UTC (Sun) by rwmj
In reply to: Thread-based or event-based?
Parent article: Thread-based or event-based?
Personally, I've found that an event-based model is great when you're doing trivial
operations (say, a transparent proxy), but tends to fall apart when you're doing more complex
stuff (say, a caching proxy with arbitrary, dynamic L7 rewrites). Get that state machine right on
the first try! Even a small change tends to turn into a huge rippling modification if you didn't
It's actually possible to implement threads on top of events. See for
example my implementation in
At the syscall level, this is using poll(2) to poll for events. However
the programming model is cooperative threads.
It's also possible to turn threads back into events, but (I'm guessing)
this won't be very efficient because threads are certainly heavier than
So this is one contribution to the argument that the kernel should just
deliver up events, and allow the userspace to deal with those
directly, or turn them into threads a la pthrlib.
to post comments)