240 likes | 262 Views
The Cost of Privatization. Hagit Attiya Eshcar Hillel Technion & EPFL Technion . A silver bullet for concurrent programming? A transaction is a sequence of operations, on a set of high level items Appears to execute atomically Ends by committing or by aborting. Transactional Memory.
E N D
The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFL Technion
A silver bullet for concurrent programming? A transaction is a sequence of operations, on a set of high level items Appears to execute atomically Ends by committingor by aborting Transactional Memory STM Read() Write() Commit / Abort The cost of privatization (June 2010)
Software TM Implementation (STM) Translates high-level operations into primitives on base objects • e.g., read, write, CAS STM The cost of privatization (June 2010)
Non-Transactional Accesses Direct operations on data items Due to legacy code, irrevocable operations, or library functions May harm memory consistency & interfere with correct operationof the STM STM The cost of privatization (June 2010)
Strong Atomicity Isolation and consistent ordering of transactions and non-transactional accesses E.g., a non-transactional readobserves the value written by an earliercommitted transaction STM The cost of privatization (June 2010)
Obvious Solution Single-operation transaction High overhead Even with compiler optimizations Want uninstrumentedaccess: single base object mfor each item t Read t read m Write t write m STM The cost of privatization (June 2010)
Privatization Cannot just assume a region is private [Guerraoui, Henzinger, Kapalka, Singh ’10] Need a privatizing transaction: isolate a data region, and access it non-transactionally Deferred updates:write / CAS applied to m(by another transaction)after t is privatized STM The cost of privatization (June 2010)
Privatization-Safe STM • A non-transactional read obtains values written by preceding committed transactions • After privatization, a base object associated with a privatized item is not written by another thread The cost of privatization (June 2010)
Linked-List Workload • A linked list & blue items are privatized • Other transactions write to blue items Cannot just write an item w/o checking first Transactions that write to data that might be private must have non-empty read sets The cost of privatization (June 2010)
Single Global Lock Efficient privatization JudoSTM[Olszewski, Cutler, Steffan, ‘07] NOrec[Dalessandro, Spear, Scott, ‘10] Inherently sequential: only one transaction makes progress The cost of privatization (June 2010)
Nonconflicting transactions must commit (even when running concurrently) RingSTM: uses global ring, not progressive [Spear, Michael, von Praun, ‘08] Private transactions: uses quiescing barrier, not progressive [Dice, Matveev, Shavit ‘10] SkySTM: Traces W-R conflicts, progressive [Lev, Luchangco, Marathe, Moir, Nussbaum, ‘09] STM Properties: Progressiveness The cost of privatization (June 2010)
No Early Updates Eager STM: Items in the write set are updated before the transaction is guaranteed to commit Lemma: Assuming progressiveness, eager STMs are not privatization-safe The cost of privatization (June 2010)
STM Properties: Obliviousness No tracking of the data sets of non conflicting transactions (do not distinguish between them) Many STMs are oblivious NOrec, RingSTM, private transactions TLRW (slotted readers)[Dice, Shavit, ’10] Exceptions are TLRW (unslotted readers), SkySTM 0 1 2 The cost of privatization (June 2010)
Cost of Privatization I: Invisible Reads Read operations do not write (also at commit-time) Reduces contention on the memory Look like empty read sets ― to the rest of the world! JudoSTM, NOrec, RingSTM Theorem: In a progressive, oblivious STM, a transaction privatizing k items in the linked-list workload must have data set of size Ω(k) The cost of privatization (June 2010)
Lower Bound with Invisible Reads: Proof p1 executing T1’ p0 executing T0 still commits invisibility p0 executes T0 privatizing the k blue items • Pick some item u that is not accessed by T0 p1 executes T1’ writing to u • Nonempty read set ready to commit but not eager u The cost of privatization (June 2010)
Lower Bound with Invisible Reads: Proof p1 executing T1’ p1 executing T1 p1 completes T1 commits progressive p0 executing T0 p0 executing T0 If T0 does not access item ti p1 now executes T1 writing ti • Nonempty read set, e.g., the linked list T1 commits after T0 commits oblivious invisible reads ti u The cost of privatization (June 2010)
Lower Bound with Invisible Reads: Proof not eager p1 executing T1 p1 completes T1 p0 executing T0 Base object mi is associated with ti p1 must write to mi in the suffix of T1 Contradicts privatization safety ti u The cost of privatization (June 2010)
Cost of Privatization II: Visible Reads Read operations write at some point, e.g. TLRW, SkySTM (read locks), private transactions • Semi-visible: the reader’s identity is unknown (oblivious) Theorem: In an ℓ-progressive, oblivious STM, a transaction privatizing k items in the linked-list workload must access min{ℓ,k} base objects • Tradeoff: memory accesses parallelism • TLRW, RingSTM realize extreme cases • Can be adapted to get intermediate tradeoffs many transactions make progress The cost of privatization (June 2010)
Lower Bound for Visible Reads: Hiding p1 executing T1’ p2 executing T2’ p0 executing T0 The cost of privatization (June 2010) T1 … Tk write to linked-list items without T0 observing them (despite being visible) “Confusing” transactions T1’ … Tk’ access a clone of the linked-list
Lower Bound for Visible Reads: Proof p1 executing T1’ p2 executing T2’ p1 executing T1’ p2 executing T2 p1 executing T1 p0 executing T0 The cost of privatization (June 2010) • Inductively, swap a confusing transaction with an updating transaction • Incurs an access to an additional base object (to observe the updating transaction) • Be careful, not to lose previous accesses
Summary Inherent cost for privatization, linear in the number of privatized items • Invisible reads: high-level accesses • Visible reads: low-level accesses • Efficient privatization requires tracking data sets of other transactions or limiting parallelism • Both have significant impact on performance Same results for disjoint-access parallel STM Same results for static & dynamic separation [Abadi, Birrell, Harris, Isard ’08][Abadi, Birrell, Harris, Hsiesh ’09] The cost of privatization (June 2010)
Alternative Costs The cost of privatization (June 2010) SkySTM is progressive, and provides efficient privatization Not oblivious: Tracks data sets in detail • All transactions have cost proportional to the size of their data set • Is this inherent?
Thank you The cost of privatization (June 2010)