1 / 38

Software Transactional Memory for Dynamic-Sized Data Structures

Software Transactional Memory for Dynamic-Sized Data Structures. Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan. Outline. Background Software Transactional Memory (STM) Implementation Long Example Experimental Results Conclusion.

tacita
Télécharger la présentation

Software Transactional Memory for Dynamic-Sized Data Structures

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. Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan

  2. Outline • Background • Software Transactional Memory (STM) • Implementation • Long Example • Experimental Results • Conclusion

  3. Transaction • A sequence of operations on components of a data structure executed by a single thread • Atomic: either • Commits: takes effect • Aborts: its effects are discarded • Linearizable: preserves program order

  4. Transactional Memory • Any system that supports concurrent execution of transactions performed by threads • Originally, a hardware idea • Now, implemented in software

  5. Transactional Objects • Is a container for a regular object • A transaction accesses it • Open • Read/modify • Changes are not seen until the transaction commits • Creation and initialization of a transactional object is not a part of any transaction

  6. Class: TMObject Locator {Transaction, oldObject, newObject} Locator * start open( ) release( ) DSTM Implementation • Is a container for a regular object • TMObject class • Implements a transactional object

  7. The transaction that most recently opened the object in WRITE mode start Locator transaction TMObject A new object version newObject oldObject An old object version DSTM Implementation

  8. Current Version • Current version of a transactional object • Determined by the status of the transaction (T) that most recently opened the object in WRITE mode

  9. transaction newObject oldObject Open(WRITE): T is COMMITTED T: COMMITTED myObj start newVersion oldVersion

  10. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is COMMITTED T: COMMITTED myObj start newVersion oldVersion A: ACTIVE A opens myObj in WRITE mode

  11. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is COMMITTED T: COMMITTED myObj start newVersion oldVersion A: ACTIVE copy Copy of newVersion A opens myObj in WRITE mode

  12. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is COMMITTED T: COMMITTED myObj start newVersion oldVersion A: ACTIVE copy Copy of newVersion A opens myObj in WRITE mode

  13. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is COMMITTED T: COMMITTED myObj start newVersion oldVersion CAS A: ACTIVE copy Copy of newVersion A opens myObj in WRITE mode

  14. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is ABORTED T: ABORTED myObj start newVersion oldVersion A: ACTIVE A opens myObj in WRITE mode

  15. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is ABORTED T: ABORTED myObj start newVersion oldVersion A: ACTIVE copy Copy of oldVersion A opens myObj in WRITE mode

  16. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is ABORTED T: ABORTED myObj start newVersion oldVersion A: ACTIVE copy Copy of oldVersion A opens myObj in WRITE mode

  17. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is ABORTED T: ABORTED myObj start newVersion oldVersion A: ACTIVE copy Copy of oldVersion A opens myObj in WRITE mode

  18. transaction newObject oldObject transaction newObject oldObject Open(WRITE): T is ACTIVE T: ACTIVE myObj start newVersion oldVersion A: ACTIVE A opens myObj in WRITE mode ? A tries to abort T

  19. Example: Integer Set • Specifications: • Object: Integer Set • Supports: • insert(v) • delete(v) • member(v) • Implementation: • Linked list of a set of elements • Sorted in ascending order

  20. MIN MAX next next Integer Set Example:Constructor start start

  21. thread MIN MAX -20 30 40 next next next next next Integer Set Example: insert(40) newElm newNode T ACTIVE T COMMITED start first start start start start

  22. thread T N O 40 MIN MAX -20 30 MIN next next next next next next Integer Set Example: insert(40) newElm newNode T COMMITED T ACTIVE start first start start start start

  23. thread T T N N O O MIN MAX -20 MIN 40 -20 30 next next next next next next next Integer Set Example: insert(40) newElm newNode T ACTIVE T COMMITED start first start start start start

  24. thread T T T N N N O O O 40 MAX -20 MIN 30 30 -20 MIN next next next next next next next next Integer Set Example: insert(40) newElm newNode T ACTIVE T COMMITED start first start start start start

  25. thread T T T N N N O O O 40 MAX -20 MIN 30 30 -20 MIN next next next next next next next next Integer Set Example: insert(40) newElm newNode T ACTIVE T COMMITED start first start start start start

  26. thread T T T T N N N N O O O O -20 MAX MAX 30 MIN -20 40 30 MIN next next next next next next next next next Integer Set Example: insert(40) newElm newNode T ACTIVE T COMMITED start first start start start start

  27. thread T T T T N N N N O O O O -20 MAX MAX 30 MIN -20 40 30 MIN next next next next next next next next next Integer Set Example: insert(40) newElm newNode T ACTIVE T COMMITED start first start start start start

  28. DSTM and Sequential Code Differences: • Need to catch Denied exception • Retry transaction that fails to commit • Distinguish between transactional objects and non-transactional objects

  29. Obstruction Freedom • Guarantees progress for any thread that eventually executes without interference for a sufficient number of steps • Strong enough to avoid problems associated with locks • Ensures that no thread can be blocked by delays or failures of other threads • Live-lock • Livelock Freedom - If some process wants to enter the critical section, then some process will eventually enter the critical section.

  30. Obstruction Freedom • Weaker progress guarantee than wait-freedom • All processes are guaranteed to complete the access in finite time, regardless of the actions of the other processes. • BUT: Efficient Contention Manager In Practice Wait Freedom Obstruction Freedom +

  31. Contention Management • Methods: • Aggressive • Abort the conflicting transaction • Interrupting a partially executed operation will not jeopardise correctness • Polite • Operations “back off” when they encounter interference • Wait for some time before retrying

  32. Contention Management • Contention manager is invoked only in case of contention  • In most lock-free and wait-free implementations, mechanisms used to ensure progress impose significant overhead even in the absence of contention

  33. Experiments • Benchmarks • IntSet • IntSet with Early Release • RBTree • Contention Management • Aggressive– abort the conflicting transaction • Polite – have a back-off algorithm

  34. Results

  35. Results

  36. Results

  37. Results

  38. Conclusion • Presented • Transactional Memory in Java/C++ • Probably easier in Java (because of the Object data type) • Good performance over simple locking

More Related