the universal transactional memory construction
play

THE UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION Jons-Tobias - PowerPoint PPT Presentation

THE UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION Jons-Tobias Wamhoff and Christof Fetzer Dresden University of Technology, Germany 1 MOTIVATION Universal construction Shows how to convert sequential algorithm into concurrent wait-free


  1. THE UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION Jons-Tobias Wamhoff and Christof Fetzer Dresden University of Technology, Germany 1

  2. MOTIVATION • Universal construction • Shows how to convert sequential algorithm into concurrent wait-free algorithm • Can one base such a construction on TM? • Wait-free progress for all correct operations • Tolerate crashes and non-terminating operations The Universal Transactional Memory Construction 2 TRANSACT‘11, San Jose, CA

  3. ASYNCHRONOUS MULTICORE SYSTEM MODEL (AMSM) • Asynchronous model with features of Shared Memory current multi-core systems Transactional Memory • Performance counters for executed cycles per thread Code Code • Size of memory is bound • Operations (transactions) can be Perf Ctr 1 Perf Ctr n executed by any thread Thread 1 Thread n • Compare-and-Swap (CAS), Operating System Fetch-and-Increment (FAI) The Universal Transactional Memory Construction 3 TRANSACT‘11, San Jose, CA

  4. AMSM CRASH FAILURES Shared Memory • Threads can crash (stop taking steps) Transactional Memory caused by: • Operating system, hardware, signal: Code Code not detectable in AMSM Perf Ctr 1 Perf Ctr n • Program code (bug): detected by Thread 1 Thread n runtime and converted in exception Operating System The Universal Transactional Memory Construction 4 TRANSACT‘11, San Jose, CA

  5. AMSM PROGRAMS • Log defines total order on a sequence of Log 0 Log 1 invocations (operations) S1 S2 Invocation 0 • FIFO sequential execution txBegin txBegin txRead txRead • Multiple logs executed in parallel txWrite txWrite txCommit txCommit • Invocations (transactions) applied to shared memory S3 S4 Invocation 1 • Sequential object to transform into wait-free txBegin txBegin linerizable object txRead txRead txWrite txWrite • Transactions can be non-terminating txCommit txCommit • Terminate correct transactions within finite number of steps The Universal Transactional Memory Construction 5 TRANSACT‘11, San Jose, CA

  6. INVOCATION PROCESSING Log 0 Log 1 Shared Memory S1 S2 Invocation 0 Transactional Memory txBegin txBegin txRead txRead How can one txWrite txWrite txCommit txCommit process invocations Code Code from k logs using n S3 S4 threads in a finite Invocation 1 txBegin txBegin number of steps? Perf Ctr 1 Perf Ctr n txRead txRead txWrite txWrite Thread 1 Thread n txCommit txCommit Operating System The Universal Transactional Memory Construction 6 TRANSACT‘11, San Jose, CA

  7. UNIVERSAL TRANSACTIONAL MEMORY CONSTRUCTION • Universal construction transforms program from one valid state to another valid state • Use TM to isolate modifications until commit • Schedule transactions on threads for wait-free progress The Universal Transactional Memory Construction 7 TRANSACT‘11, San Jose, CA

  8. STATES current Memory State History ... S0 S1 S2 S3 NULL chunks 0 0 0 1 0 1 0 3 1 0 1 0 1 2 1 2 2 0 2 0 2 2 2 2 3 0 3 1 3 1 3 3 4 0 4 0 4 0 4 3 key ct ... The Universal Transactional Memory Construction 8 TRANSACT‘11, San Jose, CA

  9. TRANSACTION SCHEDULING ONTO THREADS Log 1 ... Log k S1 Sk • A thread‘s commit time is FAI( CT ) Invocation 0 txBegin txBegin txRead txRead • S CT = f tx ( S CT -1 ) txWrite txWrite txCommit txCommit • CT -1 = i * k + l Sk+1 S2k Invocation 1 txBegin txBegin • Log l = ( CT -1) mod k txRead txRead txWrite txWrite txCommit txCommit • Invocation i = ( CT -1) div k The Universal Transactional Memory Construction 9 TRANSACT‘11, San Jose, CA

  10. TRANSACTION SCHEDULING ONTO THREADS Log 0 Log 1 S1 S2 • ct 4 = FAI( CT 4 ) Invocation 0 txBegin txBegin txRead txRead • S 4 = f tx ( S 3 ) txWrite txWrite txCommit txCommit • ct 4-1 = i * k + l S3 S4 Invocation 1 txBegin txBegin • Log l 1 = 3 mod 2 txRead txRead txWrite txWrite txCommit txCommit • Invocation i 1 = 3 div 2 The Universal Transactional Memory Construction 10 TRANSACT‘11, San Jose, CA

  11. txBegin(ct) current • Clone current head of state history S4 S2 NULL B2 • Chunks are contained only by 0 1 0 1 reference 1 2 1 2 2 2 2 2 • Set new commit time 3 1 3 1 4 0 4 0 • Keep base version key ct The Universal Transactional Memory Construction 11 TRANSACT‘11, San Jose, CA

  12. txWrite(addr, val) current S4 S2 NULL B2 • Identify chunk using hash function 0 1 0 1 • Clone chunk if still reference 1 2 1 4 2 2 2 2 • Update clone with value 3 1 3 1 4 0 4 0 key ct The Universal Transactional Memory Construction 12 TRANSACT‘11, San Jose, CA

  13. txRead(addr) current S4 S2 • Identify chunk using hash function NULL B2 • Keep commit time of chunk in read- 0 1 0 1 1 2 1 4 set if written by predecessor 2 2 2 2 3 1 3 1 • Return value of address 4 0 4 0 key ct The Universal Transactional Memory Construction 13 TRANSACT‘11, San Jose, CA

  14. txCommit • Wait until S CT -1 is available current S4 S2 S3 • Validate against S CT -1 that read- B2 set versions unchanged 0 1 0 3 0 1 1 2 1 2 1 4 • Failure : abort and retry 2 2 2 2 2 2 3 1 3 3 3 1 • Success : update chunk 4 0 4 3 4 0 references and append state to history using CAS key ct The Universal Transactional Memory Construction 14 TRANSACT‘11, San Jose, CA

  15. txCommitProceeding(ct) current S2 S3 S4 • Wait until S CT -1 is available 0 1 0 3 0 3 • Clone S CT -1 and append as S CT 1 2 1 2 1 2 2 2 2 2 2 2 using CAS 3 1 3 3 3 3 4 0 4 3 4 3 key ct The Universal Transactional Memory Construction 15 TRANSACT‘11, San Jose, CA

  16. UNIVERSAL CONSTRUCTION FOR THE GOOD CASE Log 0 Log 1 Log 2 Global State s1=ftx(S0) s2=ftx(S1) s3=ftx(S2) S3 Invocation 0 s4=ftx(S3) s5=ftx(S4) s6=ftx(S5) Invocation 1 NULL NULL NULL Invocation 2 next CT CT8 ct4 ct5 ct6 ct7 Thread 1 Thread 2 Thread 3 Thread 4 Operating System The Universal Transactional Memory Construction 16 TRANSACT‘11, San Jose, CA

  17. DEALING WITH THREAD CRASHES Log 0 Log 1 S3 S4 • Thread crashes not detectable in Invocation 1 AMSM: need helping txBegin txBegin txRead txRead txWrite txWrite txCommit txCommit • Waiting in txCommit for S CT -1 used for helping ct3 ct4 • Process S CT -1 = f tx ( S CT -2 ) Thread 1 Thread 2 current • Progress as long as one thread survives S2 S4 NULL The Universal Transactional Memory Construction 17 TRANSACT‘11, San Jose, CA

  18. DEALING WITH TRANSACTION CRASHES Log 0 Log 1 S3 S4 • Transaction crashes detectable in Invocation 1 AMSM: throw exception txBegin txBegin txRead txRead txWrite txWrite txCommit txCommit • Considered as persistent failures Invocation 2 NULL S5=S4 • Commit proceeding state Empty • No further invocations can be added current to the log S2 S3=S2 NULL The Universal Transactional Memory Construction 18 TRANSACT‘11, San Jose, CA

  19. TOLERATING NON- TERMINATING TRANSACTIONS Log 0 Log 1 S3 S4 t=12 t=23 • Non-terminating transaction: f tx ( S CT -1 ) never returns Invocation 1 txBegin txBegin txRead txRead • Use performance counter to assign quota of steps txWrite txWrite for invocation txCommit txCommit • When exceeded commit proceeding and retry NULL S5 t=13 with larger quota Invocation 2 txBegin • Quota is unknown and usually large txRead txWrite txCommit • Bounded number of states (bound memory) means bound number of steps for transaction to current complete S2 S3=S2 NULL The Universal Transactional Memory Construction 19 TRANSACT‘11, San Jose, CA

  20. CONCLUSION • Wait-free progress under AMSM by: • Decoupling of work from threads for helping • Isolating changes in transactions to mask failures The Universal Transactional Memory Construction 20 TRANSACT‘11, San Jose, CA

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend