The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

23
The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFL Technion
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    218
  • download

    0

Transcript of The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

Page 1: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The Cost of Privatization

Hagit Attiya Eshcar HillelTechnion & EPFL Technion

Page 2: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)2

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

Read)(Write)(Commit/

Abort

Transactional Memory

STM

Page 3: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)3

STM

Software TM Implementation (STM)

Translates high-level operations into primitives on base objects– e.g., read, write, CAS

Page 4: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)4

STM

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

Page 5: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)5

STM

Strong Atomicity

•Isolation and consistent ordering of transactions and non-transactional accessesE.g., a non-transactional read observes the value written by an earlier committed transaction

Page 6: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)6

STM

Obvious Solution

•Single-operation transaction–High overhead –Even with compiler optimizations

Want uninstrumented access: single base object m for each item t

•Read t read m•Write t write m

Page 7: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)7

STM

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

Page 8: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)8

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

Page 9: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)9

Linked-List Workload

A linked list & blue items are privatizedOther transactions write to blue itemsCannot just write an item w/o checking firstTransactions that write to data that

might be private must have non-empty read sets

Page 10: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)10

Single Global Lock

Efficient privatization– JudoSTM [Olszewski, Cutler, Steffan, ‘07]

– NOrec [Dalessandro, Spear, Scott, ‘10]

Inherently sequential: only one transaction makes progress

Page 11: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)11

• 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

Page 12: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)12

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

Page 13: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)13

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

012

Page 14: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)14

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)

Page 15: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)15

Lower Bound with Invisible Reads: Proof

p 1 executing T 1’ p0 executing T0

still commitsinvisibility

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

u

ready to commit but not eager

Page 16: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)16

ti

Lower Bound with Invisible Reads: Proof

p 1 executing T 1’ 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

u

p 1 executing T 1

commitsprogressive

oblivious

invisible reads

p0 executing T0

Page 17: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)17

ti

Lower Bound with Invisible Reads: Proof

u

p 1 executing T 1 p0 executing T0

not eager

Base object mi is associated with ti

p1 must write to mi in the suffix of T1

Contradicts privatization safety

Page 18: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)18

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

Page 19: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)19

•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: Hiding

p 1 executing T 1’ p0 executing T0p 2 executing T 2’

Page 20: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)20

•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

Lower Bound for Visible Reads: Proof

p 1 executing T 1’ p 2 executing T 2’ p0 executing T0

p 1 executing T 1’ p 2 executing T 2p 1 executing T 1

Page 21: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)21

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 STMSame results for static & dynamic separation

[Abadi, Birrell, Harris, Isard ’08] [Abadi, Birrell, Harris, Hsiesh ’09]

Page 22: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)22

Alternative Costs

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 setIs this inherent?

Page 23: The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.

The cost of privatization (June 2010)23

Thank you