









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Topics: transactional memory implementations
Reminders:
Assgn 7 posted (due in 2 weeks) – get started early!
As easy to program as coarse-grain locks
Performance similar to fine-grain locks - Speculative parallelization - Avoids deadlock - Resilient to faults
An implementation for a small-scale multiprocessor with a snooping-based protocol
Lazy versioning and lazy conflict detection - Does not allow transactions to commit in parallel
When a transaction issues a read, fetch the block in read-only mode (if not already in cache) and set the rd-bit for that cache line
When a transaction issues a write, fetch that block in^ read-only mode (if not already in cache), set the wr-bit for that cache line and make changes in cache - If a line with wr-bit set is evicted, the transaction must be aborted (or must rely on some software mechanism to handle saving overflowed data)
Lazy versioning: changes are made locally – the “master copy” is updated only at the end of the transaction
Lazy conflict detection: we are checking for conflicts only when one of the transactions reaches its end - Aborts are quick (must just clear bits in cache, flush pipeline and reinstate a register checkpoint) - Commit is slow (must check for conflicts, all the coherence operations for writes are deferred until transaction end) - No fear of deadlock/livelock – the first transaction to acquire the bus will commit successfully - Starvation is possible – need additional mechanisms
Writes cannot be rolled back – hence, before allowing two transactions to commit in parallel, we must ensure that they do not conflict with each other
One possible implementation: the central arbiter can collect signatures from each committing transaction (a compressed representation of all touched addresses) - Arbiter does not grant commit permissions if it detects a possible conflict with the rd-wr-sets of transactions that are in the process of committing - The “lazy” design can also work with directory protocols
Since Transaction-A’s writes are made permanent rightaway, it is possible that another Transaction-B’s rd/wr miss is re-directed to Tr-A
At this point, we detect a conflict (neither transaction has reached its end, hence, eager conflict detection) : two transactions handling the same cache line and at least one of them does a write - One solution: requester stalls: Tr-A sends a NACK to^ Tr-B; Tr-B waits and re-tries again; hopefully, Tr-A has^ committed and can hand off the latest cache line to B^ Æ neither transaction needs to abort
Can lead to deadlocks: each transaction is waiting for the^ other to finish
Need a separate (hw/sw) contention manager to detect such deadlocks and force one of them to abort Tr-A Tr-B write X write Y …
read Y read X
Nesting: when one transaction calls another
flat nesting: collapse all nested transactions into one large transaction closed nesting: inner transaction’s rd-wr set are included in outer transaction’s rd-wr set on inner commit; on an inner conflict, only the inner transaction is re-started open nesting: on inner commit, its writes are committed and not merged with outer transaction’s commit set
What if a transaction performs I/O? (buffering can help)
Transactions are often short – more than 95% of them will^ fit in cache
Transactions often commit successfully – less than 10%^ are aborted - 99.9% of transactions don’t perform I/O - Transaction nesting is not common - Amdahl’s Law again: optimize the common case! - For much more on TM: CS 7820 in Spring’