Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.
-
Upload
miles-watts -
Category
Documents
-
view
213 -
download
0
Transcript of Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.
![Page 1: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/1.jpg)
Transactional Memory Overview
Olatunji Ruwase15-740 Fall 2007
Oct 4 2007
![Page 2: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/2.jpg)
Future PCs are Multicore
![Page 3: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/3.jpg)
Parallel s/w for performance
Locks Deadlocks Priority Inversion Buggy Convoy Effect Limited concurrency
![Page 4: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/4.jpg)
Transactions Borrowed from Databases Definition : A transaction is a finite sequence
of machine instructions executed by a single process, that satisfies the following properties
Atomicity Serializability
Herlihy and Moss. “Transactional Memory: Architectural Support for Lock-free Data Structures, ISCA’93
![Page 5: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/5.jpg)
How transactions work
Make private copy of shared data Make updates on private copy If shared data is unchanged
Update shared data with private copy Else conflict has occurred
Discard private copy and repeat transaction
![Page 6: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/6.jpg)
Requirements for supporting transactions
Buffering Conflict detection Abort/Rollback Commit
![Page 7: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/7.jpg)
Transactional Memory Herlihy and Moss, ISCA ’93 ISA changes
LT,LTX, ST, COMMIT, VALIDATE, ABORT Fully associative transactional cache
Per processor Contents are exclusive of regular cache
Cache coherence protocol changes Transactional cache line states Transactional bus messages
Snoopy bus based implementation
![Page 8: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/8.jpg)
TM support for transactions
Buffering Transactional cache
Conflict detection Cache coherence protocol
Abort/Recovery Invalidate transactional cache line
Commit Validate transactional cache line
![Page 9: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/9.jpg)
Transactional Cache Fully set associative cache
Each cache line can be in only one of transactional or regular cache
Holds transactional writes Transactional writes are hidden from other
processors and memory Makes updated lines available for
snooping on COMMIT Invalidate updated line on ABORT
![Page 10: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/10.jpg)
Herlihy and Moss, ISCA ‘93
M
S
S
XCommit
XAbort
Cache Transaction Cache
CPU
Memory
![Page 11: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/11.jpg)
Sample Counter code
![Page 12: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/12.jpg)
Exposing more concurrency Doubly linked list implementation of
queue Head, Tail pointers
If queue not empty Only head pointer is used for dequeuing Only tail pointer is used for enqueuing
Concurrent enqueuing/dequeuing Possible in TM Not possible with locks
![Page 13: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/13.jpg)
Challenges of TM
Long transactions I/O Nested transactions Interrupts
![Page 14: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/14.jpg)
Other TM Ideas
Speculative Lock Elision Software Transactional Memory
Requires no hardware changes Allows composition of transactions
![Page 15: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/15.jpg)
Speculative Lock ElisionRavi and Goodman, MICRO ‘01
Speculatively remove lock acquire and removal instructions
Microarchitectural changes No changes to cache systems No changes to ISA
Can work with existing lock based code
![Page 16: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/16.jpg)
SLE example
![Page 17: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/17.jpg)
Credits for slides Bryant Lee (CMU)
Transactional Memory: Principles and Current Research
Colin Blundell (UPenn) Transaction Memory Overview
Kevin Moore (UW) Thread-Level Transactional Memory
![Page 18: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/18.jpg)
Compare TM and TLS
TM is optimistic synchronization TLS is optimistic parallelization Any other similarities or
differences
![Page 19: Transactional Memory Overview Olatunji Ruwase 15-740 Fall 2007 Oct 4 2007.](https://reader036.fdocuments.in/reader036/viewer/2022071806/56649d045503460f949d82f8/html5/thumbnails/19.jpg)
Questions/Discussions