An explanation for the popularity of threads

December 6, 2005

Today, I had an insight (possibly an obvious one) about one big reason why threads are such a popular and widespread method of doing concurrent programming:

Threads are so popular because they are so easy to implement. I don't mean 'to write programs in', because they aren't really; I mean 'to add to languages and language environments'. Unlike other models of concurrent programming, adding basic threading to your environment or your language takes very little work. So threading implementations proliferate like weeds.

(Note that there are strong arguments that good threads cannot be implemented without relatively deep support from the compiler. See Hans Boehm's paper Threads Cannot be Implemented as a Library and the resulting discussion on Lambda the Ultimate here.)

Other concurrent programming models, such as Hoare's CSP, generally require a fair bit of compiler and language support. The additional work needed means there are fewer implementations in fewer languages, with the knock on effect that it's harder for programmers to play around with these models.

(People who want to experiment with CSP style concurrent programming on Unix might find the Plan 9 'libthread' library useful. It has been ported to Unix as part of the 'Plan 9 from User Space' project, and you can find a bunch of resources on the general model and subject here.)

Written on 06 December 2005.
« Dropping packets versus rejecting them in firewall rules
How not to set up your DNS (part 4) »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Dec 6 02:15:27 2005
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.