While debugging a problem tonight, I had to read through the Solaris mutex.c source code file. If you are interested in learning the nitty gritty details behind mutual exclusion, I highly recommend reading over the section Big Theory Statement for mutual exclusion locking primitives. I am amazed at how well the Sun engineers commented the code!