1 / 19

Transaction Synchronizers

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

fai
Télécharger la présentation

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Transaction Synchronizers Virendra J MaratheVictor Luchangco Sun Microsystems Labs Sun Microsystems Labs & Univ. of Rochester October 16th, 2005

  2. 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

  3. Limitations: Concurrency • Travel Booking • Reserve air ticket • Reserve hotel room • Reserve rental car • Requirement: Booking happens atomically • Txns must do these independent ops sequentially

  4. 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

  5. Txn Interaction Not Possible!

  6. 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

  7. 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

  8. 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)

  9. The TMSynchronizer • TMSynchronizer Interface: synchronize( )method • Atomically binds caller to other txns synchronized on that TMSynchronizer • Returns the encapsulated data object

  10. 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

  11. 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 room rent a car tp = S.synchronize( ) set tp.ticket_flag set tp.room_flag set tp.car_flag wait on other flags all commit( )

  12. 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?

  13. Extensions • unsynchronize( ) • register( ) and unregister( ) • Issue: Expose synchronized txns to unsynchronized txns

  14. 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?

  15. Special Thanks to • The Scalable Synchronization Research Group, Sun Microsystems Labs • Especially to Mark Moir for reviewing a preliminary draft of the paper

  16. 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

  17. 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

  18. 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

  19. 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

More Related