Previous | Next --- Slide 36 of 37
Back to Lecture Thumbnails
Firephinx

Lock free data structures need to consider using memory fences or other kinds of barriers on a system with weaker memory consistency because if writes are reordered, then the data structure may no longer be correct. For example, a linked list or stack could become detached as in earlier slides.

username

Always try the simplest approach first - using an "atomic" statement for critical sections. It may very well be the case that implementation of fine-grain and lock-free data structures will have excess overhead leading to worse performance than a simpler locking algorithm.