Transaction synchronizers
This presentation is the property of its rightful owner.
Sponsored Links
1 / 19

Transaction Synchronizers PowerPoint PPT Presentation


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

Transaction Synchronizers. Virendra J Marathe Victor Luchangco Sun Microsystems Labs Sun Microsystems Labs & Univ. of Rochester. October 16 th , 2005. Transactional Memory (TM). Locks are hard to program with TM simplifies concurrent programming Transactions

Download Presentation

Transaction Synchronizers

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


Transaction synchronizers

Transaction Synchronizers

Virendra J MaratheVictor Luchangco

Sun Microsystems Labs Sun Microsystems Labs

&

Univ. of Rochester

October 16th, 2005


Transactional memory tm

Transactional Memory (TM)

  • Locks are hard to program with

  • TM simplifies concurrent programming

  • Transactions

    • Atomicallyexecuted sequence of instructions

    • Txns areisolated: Do not see each other

    • Isolation and atomicity simplify concurrent programming


Limitations concurrency

Limitations: Concurrency

  • Travel Booking

    • Reserve air ticket

    • Reserve hotel room

    • Reserve rental car

  • Requirement: Booking happens atomically

  • Txns must do these independent ops sequentially


Limitations condition synchronization

Limitations: Condition Synchronization

Exchange Channel

  • A meeting place for independent threads

  • Threads exchange private data over the channel

  • Can txns use the channel?

  • No, need to break isolation


Txn interaction not possible

Txn Interaction Not Possible!


A way out transaction synchronizers

A Way Out: Transaction Synchronizers

  • Relax Isolation in a restricted fashion

  • Use a transaction interaction hub, thesynchronizer

  • A transactionsynchronizesat a synchronizer

  • Data encapsulated within synchronizers

  • Access to this data can be non-transactional


A way out transaction synchronizers1

A Way Out: Transaction Synchronizers

  • Synchronized txns fate is bound

    • Commit or Abort together

  • Transitive closure of synchronized txns is thecohortset

S1

S2

Synchronizers

T1

T2

T3

Cohort

Collaborators


Dstm based synchronizers

DSTM-based Synchronizers

  • We propose an extension to DSTM [HLMS03]

  • DSTM: An STM that supports dynamic sized data structures

  • DSTM txn states: ACTIVE, ABORTED, or COMMITTED

  • Txn Synchronizer called to TMSynchronizer (is similar to DSTM’s TMObject)


The tmsynchronizer

The TMSynchronizer

  • TMSynchronizer Interface: synchronize( )method

    • Atomically binds caller to other txns synchronized on that TMSynchronizer

    • Returns the encapsulated data object


Mechanism overview

Mechanism Overview

  • Commit Protocol: Txn declares its commit intention

    • A newCOMMITTINGstate for txns

    • Txn waits for its cohort txns

  • Commit-synchronize race

    • SealTMSynchronizer’s current version when all collaborators are in COMMITTING state

  • Conflict Handling

    • Conflicts with COMMITTING txns handled differently

S1

S1

S2

S2

old

T1

T2

T3

S1

new

T4


Solution travel booking

Solution: Travel Booking

S = new TMSynchronizer( new TravelPlan( ) )TravelPlan {

spawn air ticket booking T1 tocket_flag;

spawn hotel room booking T2 room_flag;

spawn rental car booking T3 car_flag;

}

T1 T2 T3

book a ticket book a roomrent a car

tp = S.synchronize( )

set tp.ticket_flag set tp.room_flagset tp.car_flag

wait on other flags

all commit( )


Solution exchanger

Solution: Exchanger

S = new TMSynchronizer( new Exchanger( ))Exchanger {

// txn1 and txn2 are interested Data d1;

// in exchanging data items B1 and B2 Data d2;

// respectively}

T1 T2

local computation local computation

ex = S.synchronize( )

exchange:

if(CAS ex.d1 to B1) if(CAS ex.d1 to B2)

wait for ex.d2 wait for ex.d2

else else

if(CAS ex.d2 to B1) if(CAS ex.d2 to B2)

wait for ex.d1 wait for ex.d1

else else

goto exchange goto exchange

local computation local computation

T1 and T2 commit( )

What if T3 also wants

to exchange data, and

binds to T1 and T2

before they commit?

Need an unsynchronize( )

method to pull out T3?


Extensions

Extensions

  • unsynchronize( )

  • register( ) and unregister( )

  • Issue: Expose synchronized txns to unsynchronized txns


Conclusion and future work

Conclusion and Future Work

  • Txn Synchronizers: Way to relax isolation to enable txn interaction

  • Permits concurrency within atomic blocks

  • Extend Synchronizer semantics to support condition synchronization

  • Synergy with Txn Nesting?


Special thanks to

Special Thanks to

  • The Scalable Synchronization Research Group, Sun Microsystems Labs

  • Especially to Mark Moir for reviewing a preliminary draft of the paper


The tmsynchronizer1

The TMSynchronizer

  • TMSynchronizer interface: synchronize( )method

    • Atomically inserts a txn at the c-list head

Txn 1

Txn 2

c-list

Old Version

Old Data

Object

Start

New Version

TMSynchronizer

s-locator

New Data

Object


An example commit

An example commit

S-locator

c-list

Old Version

New Version

Start

TMSynchronizer

Old Data

Object

New Data

Object

CAS

Seal

Txn 1

COMMITTING

Txn 1

COMMITTED

Txn 2

COMMITTING

Txn 2

COMMITTED

Collaborators


Synchronize on a sealed tmsynchronizer

Synchronize on a Sealed TMSynchronizer

S-locator

c-list

Old Version

New Version

Start

CAS

TMSynchronizer

Copy

Old Data

Object

New Data

Object

Seal

New Data

Object

Private S-locator

c-list

Old Version

New Version

Txn 1

ACTIVE


Dstm implementation

DSTM Implementation

Transaction

Descriptor

Status: COMMITTED

Transaction

Old Version

Old Data

Object

Start

New Version

CAS

Locator

TMObject1

New Data

Object

Copy

Transaction

Descriptor

Status: ACTIVE

Transaction

Descriptor

Status: COMMITTED

Transaction

Old Version

New Version

New Transaction

Private Locator

Locator

New Data

Object


  • Login