[bind10-dev] Non-preemptive threads as an alternative to events?
Shane Kerr
shane at isc.org
Mon Mar 14 12:11:30 UTC 2011
Hello all,
Someone looked at BIND 10 and noted that we are using an event-driven
model. He is of the opinion that this is the wrong model for Internet
servers. He sent a couple of links:
http://queue.acm.org/detail.cfm?id=1105678
http://www.usenix.org/events/hotos03/tech/vonbehren.html
As far as I can tell, the idea is that the problem with threads is
concurrency - threads are by their nature non-deterministic and we need
to take very careful measures to insure that data structures remain
consistent, and that these measures cause both programming complexity
and performance issues.
Basically, locking sucks, and that's why threads suck. :)
Anyway, you can read the papers. One of the references provided is for a
very interesting threading library:
http://state-threads.sourceforge.net/docs/index.html
The idea here is that you only switch context during well-defined points
in the program - specifically the functions provided by the thread
library. In principle, this means you get the advantages of
multithreaded code (easy to read), with few of the disadvantages. The
drawback is that you can only use a single CPU at a time, since you are
only ever executing a single thread at a time. But that works okay for
servers that mostly spend their lives waiting on network I/O.
Anyway, I thought this might be worthwhile looking at before our face to
face meeting next week.
--
Shane
More information about the bind10-dev
mailing list