- Priority Queue with relaxed ordering semantics.
- Functionally similar to conventional concurrent non-blocking SkipList appart from
DeleteMin
operation DeleteMin
done by spraying on SkipList, landing at height H, jumping across L length and decending D, until reaches the bottom where it tries to pick up theNode
.- If failed for whatever reason (e.g.
Node
marked, contention orNode
is a paddingNode
, retry spray. - Proved that high probabilities
DeleteMin
return an element among the first O(p log^3 p) where p is the number of threads. - Proved that high probabilities,
DeleteMin
will retrun in O(log^3 p) regardless of SkipList size. - unlike traditional SkipList that randomly starts at the left-most
Node
clashing on the first element of each level, SparyList allowsNode
to be skip ahead, reducing contention.
- The idea is to have operation transverse the SkipList
Node
s at a controlled random motion - Generally for a SkipList probablity of a
Node
appearing at a levell
is2^-l
or 1/2^l` - each level is a LinkedList
- levels are there so search resembles O(log) instead of O(n) like linked list
- levels serves as lock-striding during contention
Node
must present at most bottom layerNode
deleted are marked (pointer marking) and later removes through some meansNode
are ordered typically left to right representing small to large respectively or whatever orderly semantics- search operation does clean up as well i.e. removing pointers / references of marked
Node
s to their predecessor and successors. - if we
Node
being marked half way through, restart again (it means someone beats us to it) - insert of
Node
is done at random height
No | Controlled Random Motion | Description |
---|---|---|
1. | Start at some Height (h) | |
2. | At level (l) definied by height (h), jump forward a random number of steps | |
3. | Transverse Node s at that level |
|
4. | Decend a number of levels (d) | |
5. | Repeat until reach the bottom most level Node |
|
6. | At the bottom find the actual Node |
|
7. | If successfully found, start deletion, else retry spray or become cleaner |
Parameters | Description |
---|---|
n | number of elements |
p | number of threads accessing |
H | starting height H = log p + K |
L | Jump length L = M * log^3 p |
D | Level to decend D = max(1, log log p) |
Se algorithm 1 in paper (section 2.2)
With spraying, highly unlikely to hit the first element, so fix this by padding 'padding' nodes.
Add K(p) dummy entries, if hit dummy entries, respray.
Each thread that reach the bottom before respray, do a low probability coin flip to turn into a cleaner. Probablity of thread becoming cleaner is 1/p.
thread adjust p, under high collision, increase it otherwise lower it.
[ ]
[ ] [ ] [ ]