Threads cannot be implemented as a library

Tuesday 6 September 2005This is 19 years old. Be careful.

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:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.