Threads cannot be implemented as a library

Tuesday 6 September 2005

Programming with threads has always been a tricky proposition. Reasoning about multiple threads of execution, and properly implementing locking strategies is difficult to do properly and requires great care and attention to detail. Unfortunately, it may not even be possible, as Hans-J. Boehm shows in his paper, Threads Cannot Be Implemented as a Library. He demonstrates that in the presence of optimizing compilers, you can't know the sequence of operations really being executed in your code, and therefore, you can't correctly call thread primitives in libraries. Only threads implemented as part of the language can be correct in all cases.

This stuff is fascinating, but it hurts my brain!

Comments

Add a comment:

name
email
Ignore this:
not displayed and no spam.
Leave this empty:
www
not searched.
 
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.