Presentation is loading. Please wait.

Presentation is loading. Please wait.

State Teleportation How Hardware Transactional Memory can Improve Legacy Data Structures Maurice Herlihy and Eli Wald Brown University.

Similar presentations


Presentation on theme: "State Teleportation How Hardware Transactional Memory can Improve Legacy Data Structures Maurice Herlihy and Eli Wald Brown University."— Presentation transcript:

1 State Teleportation How Hardware Transactional Memory can Improve Legacy Data Structures Maurice Herlihy and Eli Wald Brown University

2 Transactional Memory

3 Concurrent Data Structure = State Machine
atomic step memory barrier

4 Concurrent Data Structure = State Machine
atomic step memory barrier critical section, CAS, load/store

5 “as if” sequence of transitions
State Teleportation atomic step atomic step atomic step memory barrier memory barrier memory barrier Hardware Transaction “as if” sequence of transitions

6 Three Concurrent Lists
lazy wait-free traversal + locks lock-free lock-free everything locking hand-over-hand locking

7 Hand-Over-Hand Locking
b c d remove(b)

8 Hand-Over-Hand Locking
b c d remove(b)

9 Hand-Over-Hand Locking
b c d remove(b) Found it!

10 Hand-Over-Hand Locking
b c d remove(b)

11 Lazy List a b c remove(b)

12 Lazy List a b c remove(b)

13 Lazy List a b c remove(b)

14 Lazy List a b c remove(b)

15 Lazy List a b c validate … remove(b)

16 Lazy List a b c Logical delete remove(b)

17 Lazy List a b c Physical delete

18 Lock-Free List CAS a b c d remove(c)

19 seconds to finish 100,000 operations 80% writes, 20% modifications
Benchmarks median of 6 runs higher = worse seconds to finish 100,000 operations 80% writes, 20% modifications

20 Benchmarks every thread has a core 1-4

21 Benchmarks every thread has a hyperthread 5-8

22 Benchmarks 9-up

23 No Memory Management lazy lock-free locking

24 Memory Management? Locking: Lazy: Lock-Free: immediate re-use
hazard pointers

25 Hazard Pointers Node* hazardRead(Node** object) { while (true) {
Node* read = *object; hazard[myIndex] = read; membar(); Node* reread = *object; if (read == reread) return read; }

26 Hazard Pointers read pointer to object
Node* hazardRead(Node** object) { while (true) { Node* read = *object; hazard[myIndex] = read; membar(); Node* reread = *object; if (read == reread) return read; } read pointer to object

27 Hazard Pointers announce hazard Node* hazardRead(Node** object) {
while (true) { Node* read = *object; hazard[myIndex] = read; membar(); Node* reread = *object; if (read == reread) return read; } announce hazard

28 Hazard Pointers make announcement visible (expensive)
Node* hazardRead(Node** object) { while (true) { Node* read = *object; hazard[myIndex] = read; membar(); Node* reread = *object; if (read == reread) return read; } make announcement visible (expensive)

29 Hazard Pointers reread and validate Node* hazardRead(Node** object) {
while (true) { Node* read = *object; hazard[myIndex] = read; membar(); Node* reread = *object; if (read == reread) return read; } reread and validate

30 Without Memory Management
lazy lock-free locking

31 With Memory Management
lazy lock-free locking

32 Lock Teleportation a b c d

33 Lock Teleportation read transaction a b c d

34 Lock Teleportation read transaction a b c d

35 Lock Teleportation no locks acquired a b c d

36 Hazard PointerTeleportation
read transaction a b c d

37 Hazard PointerTeleportation
b c d

38 Hazard Pointer Teleportation
read transaction a b c d

39 Hazard Pointer Teleportation
no memory barriers a b c d

40 Without Teleportation
lazy lock-free locking

41 With Teleportation lazy lock-free locking

42 Speedup lazy lock-free locking

43 Adaptive Jumps If transaction commits … Add 1 to next distance
If transaction aborts… Cut next distance in half

44 Average Teleport Distance
lazy lock-free locking

45 Average Commit Rate lazy lock-free locking

46 Abort Reasons 4 threads 8 threads capacity explicit conflict unknown

47 Conclusions True cost of concurrent data structures
should include memory management Cost of hazard pointers can equalize lock-based and lock-free structures Adaptive Teleportation can substantially improve memory management costs for both lock-based and lock-free structures


Download ppt "State Teleportation How Hardware Transactional Memory can Improve Legacy Data Structures Maurice Herlihy and Eli Wald Brown University."

Similar presentations


Ads by Google