Does Hardware Transactional Memory Change Everything?

20
Does Hardware Transactional Memory Change Everything? Maurice Herlihy Computer Science Dept Brown University

description

Does Hardware Transactional Memory Change Everything?. Maurice Herlihy Computer Science Dept Brown University. Not important:. The details. Important. Irrevocable change. How to think about Synchronization. Amdal’s Law. Poor synchronization ruins everything. - PowerPoint PPT Presentation

Transcript of Does Hardware Transactional Memory Change Everything?

Page 1: Does Hardware Transactional Memory Change Everything?

Does Hardware Transactional Memory Change Everything?

Maurice HerlihyComputer Science Dept

Brown University

Page 2: Does Hardware Transactional Memory Change Everything?

2

Not important:The details.

ImportantIrrevocable change

Page 3: Does Hardware Transactional Memory Change Everything?

3

How to think about Synchronization

Page 4: Does Hardware Transactional Memory Change Everything?

Poor synchronization ruins everything

Amdal’s Law

Page 5: Does Hardware Transactional Memory Change Everything?

5

New synchronization architectureswill have a pervasive effect …

on the entire stack.

Not just improving …STM, lock elision, etc..

But rethinking …algorithms

theoryof data structures & libraries

models …

Page 6: Does Hardware Transactional Memory Change Everything?

6

Hand-over-Hand locking

a b c

Page 7: Does Hardware Transactional Memory Change Everything?

7

Hand-over-Hand locking

a b c

Page 8: Does Hardware Transactional Memory Change Everything?

8

Hand-over-Hand locking

a b c

Page 9: Does Hardware Transactional Memory Change Everything?

9

Hand-over-Hand locking

a b c

Page 10: Does Hardware Transactional Memory Change Everything?

10

Hand-over-Hand locking

a b c

Arguably better than a coarse-grained lock …but too many lock acquisitions …

& no overtaking.

Page 11: Does Hardware Transactional Memory Change Everything?

Transaction

11

Transactional HoH locking

a b c

read read

Page 12: Does Hardware Transactional Memory Change Everything?

12

Transactional HoH locking

a b c

HW Transactions play well with locks ….Consistent snapshot ….

Followed by lock acquisition …is something new!

Page 13: Does Hardware Transactional Memory Change Everything?

13

Lock Elision ….(That is, transparently replacing locks

with speculative transactions)Is a point solution …

Because it affects only one lock/ code block.

What about using speculation for multiple locks?

Page 14: Does Hardware Transactional Memory Change Everything?

14

Legacy code ….Dangerous to modify locking policies …

Poorly understood.

Speculatively preacquire sequence of locks?Retrofit (more) deterministic execution …

Reduce deadlocks, delays?Performance implications?

Theorem?Such transformations preserve correctness

Page 15: Does Hardware Transactional Memory Change Everything?

15

Modern locks themselves ….Very complex data structures

Read-Write AbortableNUMA Biased …

Conjecture:Perhaps we can drain the swamp ….

Same goes for:Barriers Work-stealing

Fork-join exchangersAnything done by java.util.concur

Page 16: Does Hardware Transactional Memory Change Everything?

16

RCU (read-copy-update)Readers proceed without locks …

But writers follow awkward protocol ….

``While RCU is widely adopted in the Linux kernel, it has not been applied to the kernel's address space structures because of two significant challenges: the address space structures obey complex invariants that make RCU's restrictions on readers and writers onerous, and fully applying RCU to the address space structures requires an RCU-compatible concurrent balanced tree, for which no simple solutions exist.''

[Clements et al. 2012]

Support both light-weight reads & non-trivial updates?

Page 17: Does Hardware Transactional Memory Change Everything?

17

Memory Management?Malloc/free vs lock-free data structures?

Reference counts?Hazard pointers?

RCU?

Transactions can transform & improve these techniques?

Page 18: Does Hardware Transactional Memory Change Everything?

18

Granularity?

Page 19: Does Hardware Transactional Memory Change Everything?

19

Progress guarantees?

(weasel words)

Page 20: Does Hardware Transactional Memory Change Everything?

20

A new stack ….

Data structuresAlgorithms

Synchronization structures

A new theory ….

progresscomplexity

transformations

OS, VM functions

Modern synchronization architectures require …