decs: a dynamic elimination-combining stack algorithm

31
DECS: A Dynamic Elimination- Combining Stack Algorithm Gal Bar-Nissan, Danny Hendler, Adi Suissa 1 OPODIS 2011

Upload: koto

Post on 23-Feb-2016

40 views

Category:

Documents


0 download

DESCRIPTION

DECS: A Dynamic Elimination-Combining Stack Algorithm. Gal Bar-Nissan, Danny Hendler , Adi Suissa. OPODIS 2011. Stack data-structure. We focus on the stack data-structure which supports two operations: push(v) – adds a new element (with value v) to the top of the stack - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: DECS:  A Dynamic Elimination-Combining Stack Algorithm

1

DECS: A Dynamic Elimination-

Combining Stack Algorithm

Gal Bar-Nissan,Danny Hendler,

Adi Suissa

OPODIS 2011

Page 2: DECS:  A Dynamic Elimination-Combining Stack Algorithm

2

Stack data-structureWe focus on the stack data-structure

which supports two operations:◦push(v) – adds a new element (with

value v) to the top of the stack◦pop – removes the top element from

the stack and returns it

Page 3: DECS:  A Dynamic Elimination-Combining Stack Algorithm

3

Previous work – IBM/Treiber algorithm [1986]

Linked-list basedShared top pointer

next

next

top

nextnew

old

top

new

top

push operation

pop operation

Non-blocking algorithm Poor scalability (essentially sequential)

Page 4: DECS:  A Dynamic Elimination-Combining Stack Algorithm

4

Previous work – Flat-combining [Hendler, Incze, Shavit, Tzafrir, 2010]

A list of operations to be performed

Each thread adds its operation to the listOne of the threads acquires a global lock

and performs the combined operationOther threads spin and wait for their

operation to be performed

push

pop push

push

pop push

Minimizes synchronization

Blocking algorithm Limited scalability (essentially sequential)

Page 5: DECS:  A Dynamic Elimination-Combining Stack Algorithm

5

Previous work – Elimination Backoff (HSY) [Hendler, Shavit, Yerushalmi, 2004]

Eliminating reverse semantics operations

A thread attempts its operation:1. On the central stack (IBM/Treiber algorithm)2. Elimination Backoff – Eliminate with another

threadT1

T2

T3

pop

push( )

pop

T1

Central Stack

Non-blocking algorithm Provides parallelism – if workloads are symmetric

Page 6: DECS:  A Dynamic Elimination-Combining Stack Algorithm

6

Our contributionsDECS – A Dynamic Elimination-

Combining Stack algorithm

Dynamically employs either of two techniques:1. Elimination2. Combining

A non-blocking version (NB-DECS)

Page 7: DECS:  A Dynamic Elimination-Combining Stack Algorithm

7

DECS – Dynamic Elimination-Combining StackEmploys IMB/Treiber’s algorithm as a

central stack

A thread attempts its operation:1. On the central stack2. Elimination-Combining Backoff – Eliminate or

Combine with another thread

Page 8: DECS:  A Dynamic Elimination-Combining Stack Algorithm

8

Elimination-Combining layer

A thread attempts its operation on the central

stack

1T1

Central Stack

op1

If that fails, it registers itself in a publication array

2

T1

It then chooses a random index from the publication array, and looks for another

thread

3

If no other thread is found, the thread waits

Page 9: DECS:  A Dynamic Elimination-Combining Stack Algorithm

9

Elimination-Combining layer (cont'd)

4T2

Central Stack

op2

T1 T2

If it finds another thread with a reverse semantics

operation, the operations are eliminated

5

op1 != op2

Another thread that fails operating on the central

stack also registers in the array and tries to find

Another thread

Page 10: DECS:  A Dynamic Elimination-Combining Stack Algorithm

10

If both threads have identical operation

semantics, one thread delegates its operation to

the other thread

6T2

Central Stack

op2

T1 T2

op1 == op2

T1

Elimination-Combining layer (cont'd)

delegate thread

Page 11: DECS:  A Dynamic Elimination-Combining Stack Algorithm

11

Multi-PushT1

Central Stack

push

T1 Ta Tb

Page 12: DECS:  A Dynamic Elimination-Combining Stack Algorithm

12

Multi-PopT1

Central Stack

pop

T1 Ta Tb Tc

M

M = min{stack_size, multi_op_size}

Page 13: DECS:  A Dynamic Elimination-Combining Stack Algorithm

13

Multi-Eliminate

T1

pushT1 Ta Tb

T2 Tc Td TeT2

pop

Retry!

Page 14: DECS:  A Dynamic Elimination-Combining Stack Algorithm

14

Data-structures

Page 15: DECS:  A Dynamic Elimination-Combining Stack Algorithm

Push & Pop operations

Page 16: DECS:  A Dynamic Elimination-Combining Stack Algorithm

MultiPop function

Page 17: DECS:  A Dynamic Elimination-Combining Stack Algorithm

17

Collide function

Page 18: DECS:  A Dynamic Elimination-Combining Stack Algorithm

18

ActiveCollide, Combine functions

Page 19: DECS:  A Dynamic Elimination-Combining Stack Algorithm

19

MultiEliminate function

Page 20: DECS:  A Dynamic Elimination-Combining Stack Algorithm

20

PassiveCollide

Page 21: DECS:  A Dynamic Elimination-Combining Stack Algorithm

21

Experimental EvaluationEvaluated on an UltraSPARC T2+ –

8 cores CPU (each with 8 hardware threads) 64 hardware threads

Compared DECS with:◦ Treiber (with exponential backoff)◦ HSY (elimination backoff) algorithm◦ Flat-Combining (FC) stack

Page 22: DECS:  A Dynamic Elimination-Combining Stack Algorithm

22

Symmetric workload50% push – 50% pop

Threads

Thro

ughp

ut

Page 23: DECS:  A Dynamic Elimination-Combining Stack Algorithm

23

Moderately Asymmetric75% push – 25% pop

Threads

Thro

ughp

ut

Page 24: DECS:  A Dynamic Elimination-Combining Stack Algorithm

24

Fully Asymmetric100% push – 0% pop

Threads

Thro

ughp

ut

Page 25: DECS:  A Dynamic Elimination-Combining Stack Algorithm

25

DECS summary Scalable

Provides parallelism even for asymmetric workloads

Blocking

Page 26: DECS:  A Dynamic Elimination-Combining Stack Algorithm

26

Non-blocking DECSA non-blocking algorithm is more

robust to thread failures

Similar to DECS, but threads that delegate an operation do not wait indefinitely

A thread stops waiting by signaling its delegate thread

Page 27: DECS:  A Dynamic Elimination-Combining Stack Algorithm

27

NB-DECS - exampleA thread may stop waiting

after some timeoutT1

Central Stack

push

T1 Ta TbX

X

Page 28: DECS:  A Dynamic Elimination-Combining Stack Algorithm

28

NB-DECS - overhead1. Test-and-set validation of each

popped element from the central stack

2. Elements must be popped from the central stack one-by-one

3. Test-and-set validation on eliminated operations

Page 29: DECS:  A Dynamic Elimination-Combining Stack Algorithm

29

Symmetric workload50% push – 50% pop

Threads

Thro

ughp

ut

Page 30: DECS:  A Dynamic Elimination-Combining Stack Algorithm

30

Moderately Asymmetric75% push – 25% pop

Threads

Thro

ughp

ut

Page 31: DECS:  A Dynamic Elimination-Combining Stack Algorithm

31

Moderately Asymmetric25% push – 75% pop

Threads

Thro

ughp

ut