Coarse grained transactions
This presentation is the property of its rightful owner.
Sponsored Links
1 / 48

Coarse-Grained Transactions PowerPoint PPT Presentation


  • 59 Views
  • Uploaded on
  • Presentation posted in: General

Coarse-Grained Transactions. Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson   (POPL 10). Skew Heaps. Tree with “heap” property. 0. 1. 2. 3. 4. Concurrent Skew Heap. Insert me!. Insert me!. 6. 0. 2. 1. 3. 4. 5. Concurrent Skew Heap. 2. 6.

Download Presentation

Coarse-Grained Transactions

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Coarse grained transactions

Coarse-Grained Transactions

Maurice Herlihy

Brown University

Joint work with Eric Koskinen and Matthew Parkinson  (POPL 10)


Skew heaps

Skew Heaps

Tree with “heap” property

0

1

2

3

4

TMW April 2010


Concurrent skew heap

Concurrent Skew Heap

Insert me!

Insert me!

6

0

2

1

3

4

5

TMW April 2010


Concurrent skew heap1

Concurrent Skew Heap

2

6

0

Lock parent

Swap R & L

1

3

4

5

TMW April 2010


Concurrent skew heap2

Concurrent Skew Heap

2

6

0

Unlock parent

1

3

4

5

Lock right child

TMW April 2010


Concurrent skew heap3

Concurrent Skew Heap

No global rebalancing

6

0

1

3

Good amortized performance

4

5

2

Good concurrency

TMW April 2010


Transactional skew heap

Transactional Skew Heap

Insert me!

Insert me!

6

0

2

1

3

4

5

TMW April 2010


Transactional skew heap1

Transactional Skew Heap

Good concurrency with locking

2

6

0

Write-write conflict!

I wrote

Not with transactions …

1

3

0

4

5

Confusion between

thread-level & transaction-level synchronization

TMW April 2010


Coarse grained synchronization

Coarse-Grained Synchronization

Synchronize on high-level operations,

Like add(), remove(), etc. …

Not low-level reads and writes

Pessimistic: update in place, undo on abort

Optimistic: update private copy, apply changes on commit

But what is the meaning ofconflict?

TMW April 2010


Pessimistic boosting

Pessimistic Boosting

Undo Logs

transactions

Abstract locks

Black-box linearizable data object

TMW April 2010


Pessimistic boosting1

Pessimistic Boosting

add(x)

Undo Logs

transactions

Abstract locks

Black-box linearizable data object

TMW April 2010


Pessimistic boosting2

Pessimistic Boosting

add(x)

Undo Logs

transactions

Abstract locks

Black-box linearizable data object

TMW April 2010


Pessimistic boosting3

Pessimistic Boosting

add(x)

Undo Logs

transactions

Abstract locks

Black-box linearizable data object

TMW April 2010


Pessimistic boosting4

Pessimistic Boosting

add(x)

rem(x)

x

Undo Logs

transactions

Abstract locks

Black-box linearizable data object

TMW April 2010


Pessimistic boosting5

Pessimistic Boosting

add(x)

rem(x)

add(y)

x

y

Undo Logs

transactions

Abstract locks

Black-box linearizable data object

TMW April 2010


Pessimistic boosting6

Pessimistic Boosting

add(x)

rem(x)

member(x)

x

Undo Logs

transactions

Abstract locks

Black-box linearizable data object

TMW April 2010


Pessimistic boosting7

Pessimistic Boosting

Thread-safe base object

Log Inverses

Updated in place

Conflicting operations blocked by abstract locks

What does it mean for operations to conflict?

TMW April 2010


Optimistic boosting

Optimistic Boosting

Black-box linearizable data object

TMW April 2010


Optimistic boosting1

Optimistic Boosting

private copies

Black-box linearizable data object

TMW April 2010


Optimistic boosting2

Optimistic Boosting

redo logs

private copies

Black-box linearizable data object

TMW April 2010


Optimistic boosting3

Optimistic Boosting

add(x)

redo logs

private copies

Black-box linearizable data object

TMW April 2010


Optimistic boosting4

Optimistic Boosting

add(x)

redo logs

add(x)

private copies

x

Black-box linearizable data object

TMW April 2010


Optimistic boosting5

Optimistic Boosting

add(y)

add(x)

redo logs

add(x)

add(y)

private copies

x

y

Black-box linearizable data object

TMW April 2010


On commit

On Commit

redo logs

add(x)

add(y)

add(x)

private copies

x

y

add(x)

Black-box linearizable data object

TMW April 2010


On commit1

No conflict, apply updates to my copy

On Commit

redo logs

add(x)

add(y)

add(x)

private copies

x

x

y

add(x)

x

Black-box linearizable data object

TMW April 2010


On commit2

On Commit

Different physical values,

Same logical values

add(x)

add(y)

add(x)

x

x

y

add(x)

x

TMW April 2010


On commit3

Conflict! Abort & restore my copy

On Commit

redo logs

add(x)

rem(x)

add(x)

private copies

x

add(x)

x

Black-box linearizable data object

TMW April 2010


Optimistic boosting6

Optimistic Boosting

Thread-local object copies

Deferred operatons kept in redo log

No inverses

On commit, broadcast deferred operations

To other transactions, public copy

Transactions snoop on broadcast,

Abort if conflict detected

What does it mean for operations to conflict?

TMW April 2010


Left movers

time

Left-Movers

legal history

TMW April 2010


Left movers1

time

Left-Movers

If and are adjacent,

Ok to move earlier

TMW April 2010


Left mover example semaphore

time

Left-Mover Example: Semaphore

dec()

inc()

dec()

1

0

1

0

TMW April 2010


Inc is left mover wrt dec

time

Inc() is Left-mover WRT Dec()

inc()

dec()

dec()

1

0

1

1

0

2

1

1

0

TMW April 2010


Left mover example semaphore1

time

Left-Mover Example: Semaphore

Same sequence of calls

(results unaffected)

inc()

dec()

dec()

1

0

1

1

0

2

1

1

0

TMW April 2010


Left mover example semaphore2

time

Left-Mover Example: Semaphore

inc()

dec()

dec()

3

3

2

3

2

4

3

3

2

Same final state

TMW April 2010


Left mover counter example

dec()

inc()

dec()

time

0

1

0

Left-Mover Counter-example

1

TMW April 2010


Dec not left mover wrt inc

dec()

inc()

dec()

time

0

1

0

Dec() not Left-Mover WRT Inc()

-1

1

TMW April 2010


Right movers

time

Right-Movers

legal history

TMW April 2010


Right movers1

time

Right-Movers

If and are adjacent,

Ok to move later

TMW April 2010


Commutativity

time

Commutativity

If and are adjacent,

Ok to swap

TMW April 2010


Pessimistic semantics modify shared state in place

time

Pessimistic Semantics(modify shared state in place)

Txn A

beg

cmt

Txn B

beg

Pessimistic Commit: Move Left of pending

What Theory? Sept 2009


Pessimistic semantics modify shared state in place1

time

Pessimistic Semantics(modify shared state in place)

Txn A

beg

abt

Txn B

beg

What Theory? Sept 2009


Pessimistic semantics modify shared state in place2

time

Pessimistic Semantics(modify shared state in place)

Txn A

beg

2

3

1

3

2

4

4

1

Txn B

beg

Pessimistic Abort: Move Right of pending

Pessimistic Abort: Pending ops move Left

What Theory? Sept 2009


Pessimistic semantics modify shared state in place3

Pessimistic Semantics(modify shared state in place)

  • Operations must be LEFT moversw.r.t. other pending operations

  • On commit, move operations LEFT

  • On abort, move operations RIGHT (free)and append inverses

What Theory? Sept 2009


Optimistic semantics modify local copies merge

time

Optimistic Semantics(modify local copies; merge)

Txn A

beg

cmt

Txn B

cmt

Optimistic Commit: Move Right of committed

What Theory? Sept 2009


Optimistic semantics modify local copies merge1

time

Optimistic Semantics(modify local copies; merge)

Txn A

beg

abt

Txn B

cmt

Optimistic Abort: Discard Operations

What Theory? Sept 2009


Optimistic semantics modify local copies merge2

Optimistic Semantics(modify local copies; merge)

  • Operations must be RIGHT moversw.r.t. concurrently committed operations

  • On commit, move operations RIGHT

  • Abort if concurrent non-LM op

  • On abort, discard local changes

What Theory? Sept 2009


Two execution models

Two Execution Models

Algebraic Abstract Properties

What Theory? Sept 2009


Challenges

Challenges

  • Automation?

    • Theorem proving

    • Model checking

  • Compiler & Language support?

  • Implementation …

TMW April 2010


  • Login