views:

19

answers:

0

Looking for a minimal, futex-based implementation of a single-writer/multiple-readers lock requiring no space overhead beyond a single 4-byte futex state variable.

Some background: I have an application which will embed a lock within each of tens to hundreds of millions of small objects. Because of the very fine grained nature of the locking and the structure of the application I anticipate minimal contention. Further, writers will be rare and contending writers rarer still. For all of these reasons, in this particular setting, a solution prone (in theory) to the "thundering heard" phenomenon is quite acceptable.