U of U CS 7810 - Lecture 7 - Lazy & Eager Transactional Memory

Unformatted text preview:

Slide Number 1Slide Number 2Slide Number 3Slide Number 4Slide Number 5Slide Number 6Slide Number 7Slide Number 8Slide Number 9Slide Number 10Slide Number 11Slide Number 12Slide Number 13Slide Number 14Slide Number 15Slide Number 16Slide Number 17Slide Number 18Slide Number 191Lecture 7: Lazy & Eager Transactional Memory• Topics: details of “lazy” TM, scalable lazy TM,implementation details of eager TM2Lazy OverviewTopics:• Commit order• Overheads• Wback, WAR, WAW, RAW• Overflow• Parallel Commit• Hiding Delay• I/O• Deadlock, Livelock, StarvationCPR WCPR WCPR WCPR WMA3“Lazy” Implementation (Partially Based on TCC)• An implementation for a small-scale multiprocessor witha snooping-based protocol• Lazy versioning and lazy conflict detection• Does not allow transactions to commit in parallel4Handling Reads/Writes• When a transaction issues a read, fetch the block inread-only mode (if not already in cache) and set therd-bit for that cache line• When a transaction issues a write, fetch that block inread-only mode (if not already in cache), set the wr-bitfor that cache line and make changes in cache• If a line with wr-bit set is evicted, the transaction mustbe aborted (or must rely on some software mechanismto handle saving overflowed data) (or must acquirecommit permissions)5Commit Process• When a transaction reaches its end, it must now makeits writes permanent• A central arbiter is contacted (easy on a bus-based system),the winning transaction holds on to the bus until all writtencache line addresses are broadcasted (this is the commit)(need not do a writeback until the line is evicted or writtenagain – must simply invalidate other readers of these lines)• When another transaction (that has not yet begun to commit)sees an invalidation for a line in its rd-set, it realizes itslack of atomicity and aborts (clears its rd- and wr-bits andre-starts)6Miscellaneous Properties• While a transaction is committing, other transactions cancontinue to issue read requests• Writeback after commit can be deferred until the nextwrite to that block• If we’re tracking info at block granularity, (for variousreasons), a conflict between write-sets must force an abort7Summary of Properties• Lazy versioning: changes are made locally – the “master copy” isupdated only at the end of the transaction• Lazy conflict detection: we are checking for conflicts only when one ofthe transactions reaches its end• Aborts are quick (must just clear bits in cache, flush pipeline andreinstate a register checkpoint)• Commit is slow (must check for conflicts, all the coherence operationsfor writes are deferred until transaction end)• No fear of deadlock/livelock – the first transaction to acquire the bus willcommit successfully• Starvation is possible – need additional mechanisms8TCC Features• All transactions all the time (the code only definestransaction boundaries): helps get rid of the baselinecoherence protocol• When committing, a transaction must acquire a centraltoken – when I/O, syscall, buffer overflow is encountered,the transaction acquires the token and starts commit• Each cache line maintains a set of “renamed bits” – thisindicates the set of words written by this transaction –reading these words is not a violation and the read-bit isnot set9TCC Features• Lines evicted from the cache are stored in a write buffer;overflow of write buffer leads to acquiring the commit token• Less tolerant of commit delay, but there is a high degreeof “coherence-level parallelism”• To hide the cost of commit delays, it is suggested that acore move on to the next transaction in the meantime –this requires “double buffering” to distinguish betweendata handled by each transaction• An ordering can be imposed upon transactions – useful forspeculative parallelization of a sequential program10Parallel Commits• Writes cannot be rolled back – hence, before allowingtwo transactions to commit in parallel, we must ensurethat they do not conflict with each other• One possible implementation: the central arbiter cancollect signatures from each committing transaction(a compressed representation of all touched addresses)• Arbiter does not grant commit permissions if it detectsa possible conflict with the rd-wr-sets of transactionsthat are in the process of committing• The “lazy” design can also work with directory protocols11Scalable Algorithm – Lazy Implementation• Data is distributed across several nodes/directories• Each node has a token• For a transaction to commit, it must first acquire all tokenscorresponding to the data in its read and write set – this guarantees that an invalidation will not be received whilethis transaction commits• After performing the writes, the tokens are released• Tokens must be acquired in numerically ascending orderfor deadlock avoidance – can also allow older transactionsto steal from younger transactions12ExampleP1T1D1:X ZP2T2YRd XWr XRd YWr ZD2:13“Eager” OverviewTopics:• Logs• Log optimization• Conflict examples• Handling deadlocks• Sticky scenarios• Aborts/commits/parallelismCDirPR WCDirPR WCDirPR WCDirPR WScalable Non-broadcast Interconnect14“Eager” Implementation (Based Primarily on LogTM)• A write is made permanent immediately (we do not waituntil the end of the transaction)• Can’t lose the old value (in case this transaction isaborted) – hence, before the write, we copy the oldvalue into a log (the log is some space in virtual memory-- the log itself may be in cache, so not too expensive)This is eager versioning15Versioning• Every overflowed write first requires a read and a write tolog the old value – the log is maintained in virtual memoryand will likely be found in cache • Aborts are uncommon – typically only when thecontention manager kicks in on a potential deadlock; thelogs are walked through in reverse order• If a block is already marked as being logged (wr-set), thenext write by that transaction can avoid the re-log• Log writes can be placed in a write buffer to reducecontention for L1 cache ports16Conflict Detection and Resolution• Since Transaction-A’s writes are made permanentrightaway, it is possible that another Transaction-B’srd/wr miss is re-directed to Tr-A• At this point, we detect a conflict (neither transaction hasreached its end, hence, eager conflict detection): twotransactions handling the same cache


View Full Document

U of U CS 7810 - Lecture 7 - Lazy & Eager Transactional Memory

Download Lecture 7 - Lazy & Eager Transactional Memory
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 7 - Lazy & Eager Transactional Memory and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 7 - Lazy & Eager Transactional Memory 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?