File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
module Concurrent
5
5
module Edge
6
+ # This class implements a lock-free linked set. The general idea of this
7
+ # implementation is this: each node has a successor which is an Atomic
8
+ # Markable Reference. This is used to ensure that all modifications to the
9
+ # list are atomic, preserving the structure of the linked list under _any_
10
+ # circumstance in a multithreaded application.
11
+ #
12
+ # One interesting aspect of this algorithm occurs with removing a node.
13
+ # Instead of physically removing a node when remove is called, a node is
14
+ # logically removed, by 'marking it.' By doing this, we prevent calls to
15
+ # `remove` from traversing the list twice to perform a physical removal.
16
+ # Instead, we have have calls to `add` and `remove` clean up all marked
17
+ # nodes they encounter while traversing the list.
18
+ #
19
+ # This algorithm is a variation of the Nonblocking Linked Set found in
20
+ # 'The Art of Multiprocessor Programming' by Herlihy and Shavit.
6
21
class LockFreeLinkedSet
7
22
include Enumerable
8
23
You can’t perform that action at this time.
0 commit comments