Herb Sutter, known for his articles on concurrency, published an article on Lock-free code on August 5th. Herb continues his exploration of lock-free code–this time focusing on creating a lock-free queue.
“When writing lock-free code, always keep these essentials well in mind:
* Key concepts. Think in transactions. Know who owns what data.
* Key tool. The ordered atomic variable.
When writing a lock-free data structure, “to think in transactions” means to make sure that each operation on the data structure is atomic, all-or-nothing with respect to other concurrent operations on that same data. The typical coding pattern to use is to do work off to the side, then “publish” each change to the shared data with a single atomic write or compare-and-swap. [3] Be sure that concurrent writers don’t interfere with each other or with concurrent readers, and pay special attention to any operations that delete or remove data that a concurrent operation might still be using.”



1 response so far ↓
1 Writing a Generalized Concurrent Queue // Oct 29, 2008 at 12:15 pm
[...] for his articles on concurrency, published an article on Lock-free code on August 5th and another on creating a lock-free queue. Today Dr. Dobb’s Journal publishes another article by Herb discussing how to tackle the [...]