What every systems programmer should know about lockless concurrency [pdf]
Keep in mind lockless algorithms are not necessarily more scalable than lock-based algorithms, usually have higher constant overheads, and are significantly easier to get wrong.However, this post is, in part, about how to implement locks.