Download - SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas
![Page 1: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/1.jpg)
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS
Daniel Cederman and Philippas Tsigas
![Page 2: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/2.jpg)
Overview
SUPPORTING OF
CONCURRENT DATA OBJECTS
COMPOSITION
LOCK-FREE
![Page 3: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/3.jpg)
Concurrent Data Objects
Data structures shared between processes
and other …
Trees Skiplists
Queues
HashtablesFor example …
![Page 4: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/4.jpg)
Synchronization
Synchronization is required for concurrency
Mutual exclusion Locks limits concurrency Busy waiting – repeated checks to see if
lock has been released or not Convoying – processes stack up before
locks A better approach is to use data
structuresthat are …
![Page 5: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/5.jpg)
Overview
CONCURRENT DATA OBJECTS
COMPOSITION
LOCK-FREE
![Page 6: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/6.jpg)
Lock-free
Lock-freedom is a progress guarantee
In practice it means that A fast process doesn’t
have to wait for a slowor dead process
Can’t be designed withblocking parts
No deadlocks
Shown to scale better than blocking approaches
DefinitionFor all possible
executions, at least one concurrent
operation will succeed in a finite number of its
own steps
![Page 7: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/7.jpg)
Libraries using Lock-free Data Objects
Java Concurrency Package Threading Building Blocks by Intel .NET Parallel Extensions NOBLE Non-Blocking Library …
![Page 8: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/8.jpg)
Overview
CONCURRENT DATA OBJECTS
COMPOSITION
LOCK-FREE
![Page 9: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/9.jpg)
Composition
FC
DC
A B C
FC
DA B C
Dequeue Insert
Dequeue
Insert
Queue Tree
QueueTree
?
![Page 10: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/10.jpg)
Challenge
Providing efficiency and correctness while dealing with Specialized designs Few common algorithmic components Complex proofs of correctness
We target a large class of concurrent data objects
![Page 11: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/11.jpg)
Concurrent Data Objects
Have operations for insertion and removal
of elements
Can be composed to form move operations
Trees Skiplists
Queues
Hashtables
and other …
![Page 12: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/12.jpg)
Contributions
We provide a framework that consists of three parts Properties used to identify compatible
objects Steps needed to adapt object Algorithmic design of operation for
performinglock-free moves between adapted objects
![Page 13: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/13.jpg)
Characterization
1. Have operations equivalent to insert and remove
2. These operations are linearizable3. …4. …
![Page 14: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/14.jpg)
Linearizability
Operation A Operation C
Operation B Operation D
Linearizable if for any concurrent history there exists a correct sequential history where …
A happens before B, if A finished before B
started
Either C happens before D
or D happens before C,if C and D are concurrent
![Page 15: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/15.jpg)
Linearization Points
Operation A Operation C
Operation B Operation D
Linearization point
Linearization point
Linearization point
Linearization point
![Page 16: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/16.jpg)
Linearization Points
Operation A Operation C
Operation B Operation D
![Page 17: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/17.jpg)
Characterization
1. Have operations equivalent to insert and remove
2. These operations are linearizable3. …4. …
![Page 18: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/18.jpg)
Insert Element into BRemove Element from A
Composition
![Page 19: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/19.jpg)
Composition
Remove - prolog
Insert - prolog
Remove - epilog
Insert - epilog
![Page 20: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/20.jpg)
Composition
Remove - prolog
Insert - prolog
Remove - epilog
Insert - epilog
Element to remove must be accessible here!
![Page 21: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/21.jpg)
Characterization
1. Have operations equivalent to insert and remove
2. These operations are linearizable3. The element to remove is accessible
before the linearization point4. …
![Page 22: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/22.jpg)
Composition
Remove - prolog
Insert - prolog
Remove - epilog
Insert - epilog
Linearization point is often a successful compare-and-swap
![Page 23: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/23.jpg)
Composition
Remove - prolog
Insert - prolog
Remove - epilog
Insert - epilog
Prolog
Epilog
if(CAS(…))
Only fails if other process
succeeds
![Page 24: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/24.jpg)
Failed! Failed!Success! Failed!Failed! Success!
Success! Success!
RemoveInsert DCASFailed!Failed!Failed!
Success!
Composition
Remove - prolog
Insert - prolog
Remove - epilog
Insert - epilog
Combined using a double-word
compare-and-swap
![Page 25: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/25.jpg)
Characterization
1. Have operations equivalent to insert and remove
2. These operations are linearizable3. The element to remove is accessible
before the linearization point4. The linearization point for a successful
operation is a successful compare-and-swap
Can be composed to move operations
![Page 26: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/26.jpg)
Compatible Concurrent Data Objects
There are a wide variety of commonly used lock-free data structures that supports these requirements Queues [PODC ‘96] Lists [PODC ‘04] Skip-Lists [IPDPS ‘03] Priority Queues [JPDC ‘05] Hash-tables [SPAA ‘02] Dictionaries [SAC ‘04] Stacks [Treiber ‘86] …
![Page 27: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/27.jpg)
Reverts to normal compare-and-swap if used outside
move operation
Move Operation
Prolog
SCAS1
Prolog
SCAS2
Epilog
Epilog
Remove operation Insert operationMove support
Performs double-word compare-and-swap
Can only fail if other process succeeds
![Page 28: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/28.jpg)
Case Study - Stack
bool pop(value)
while(true)
ltop = top;
if(ltop == 0) return false;
value = ltop.value;
if(cas(top, ltop, ltop.next))
return true;
Not a successful operation
Successful operation connected to a
successful CAS
Accessible before linearization point
![Page 29: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/29.jpg)
Case Study - Stack
bool pop(value)
while(true)
ltop = top;
if(ltop == 0) return false;
value = ltop.value;
if(scas(top, ltop, ltop.next, value))
return true;
The scas is called with the value to move
![Page 30: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/30.jpg)
Generic Move Operation
![Page 31: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/31.jpg)
Performance Evaluation
The evaluation was performed on a machine with an Intel Core i7 950 3GHz processor and 6GB DDR3-1333 memory
4 Cores with Hyper-Threading
Enqueue Dequeue
Move
Enqueue Dequeue
![Page 32: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/32.jpg)
Queue – Insert and Remove
1 2 4 6 8 10 12 14 160
100
200
300
400
500
600
700
Blocking
Threads
Tim
e (
ms)
![Page 33: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/33.jpg)
Queue – Move Operations
1 2 4 6 8 10 12 14 160
500
1000
1500
2000
2500
Blocking
Threads
Tim
e (
ms)
![Page 34: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/34.jpg)
Queue – Insert/Remove/Move
1 2 4 6 8 10 12 14 160
200
400
600
800
1000
1200
1400
1600Blocking
Threads
Tim
e (
ms)
![Page 35: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/35.jpg)
1 2 4 6 8 10 12 14 160
50
100
150
200
250
Before After
Threads
Tim
e (
ms)
Queue – Before/After Adaptation
![Page 36: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/36.jpg)
Summary
We provide a framework that consists of three parts Properties used to identify compatible objects Steps needed to adapt object Algorithmic design of operation for performing
lock-free moves between adapted objects
Adaptation does not affect standard operations
![Page 37: SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649db95503460f94aaa222/html5/thumbnails/37.jpg)
For more information:www.cse.chalmers.se/research/group/dcs
Thank you!