atom-aid: detecting and surviving atomicity violations brandon lucia, joseph devietti, karin strauss...

30
Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle Goodstein

Upload: rudolph-alexander

Post on 18-Jan-2018

216 views

Category:

Documents


0 download

DESCRIPTION

Motivation Observe that BulkSC, ASO, Implicit Transactions provide implicit atomicity  Implicit Atomicity: Two accesses in the same “chunk” appear atomic Leverage implicit atomicity to avoid atomicity violations

TRANSCRIPT

Page 1: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid: Detecting and Surviving Atomicity Violations

Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze

LBA Reading Group 7/3/08Slides by Michelle Goodstein

Page 2: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Motivation

Parallel programs are hard to writeNon-deterministic bugs emerge

Data racesDeadlocksAtomicity Violations

Non-deterministically affect program performanceLarge portion of non-deadlock concurrency bugs

Page 3: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Motivation

Observe that BulkSC, ASO, Implicit Transactions provide implicit atomicityImplicit Atomicity: Two accesses in the same

“chunk” appear atomicLeverage implicit atomicity to avoid

atomicity violations

Page 4: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Outline

MotivationImplicit AtomicityAtom-Aid DesignExperimental Setup & ResultsConclusions

Page 5: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Implicit Atomicity

Property of systems that:Group instructions into larger chunks Support consistency at coarser granularity

Coarse grain consistencyReduces space of possible interleavingsSoftware remains oblivious

Atom-AidWorks if system provides implicit atomicityBuilt on BulkSC

Page 6: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atomicity Violation

Page 7: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Space of Interleavings

Page 8: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Serializability

Serializable iff order assumed by the programmer produces same final state as actual interleaving

Page 9: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Serializability

Page 10: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Implicit Atomicity and Atomicity Violations

Atomicity-lacking sectionPortion of code from one memory access to

another which should be atomic but is notIntuitively: If all code for an atomicity

violation lies within same “chunk”, violation will never occurNatural hiding

Page 11: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Implicit Atomicity and Atomicity Violations

Formallyc is the default chunk sized is the size of an atomicity-lacking section

If c < d|Atomicity-lacking section| > |default chunk|Pr(hiding violation) = 0

If c ≥ dPr(hiding violation) = (c-d+1)/c

Page 12: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Hiding an Atomicity Violation

d

atomicitylackingsection

Chunk

bdry

Chunk bdry

(c-d)th instr

c

1st memory operation from atomicity lacking section here, entire section atomic

Page 13: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Implications of natural hiding

Page 14: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atomicity Violation Statistics

Typical atomicity violation: 500-750 instrIf chunk size ~ 2,000 instrs

Pr(hiding violation) around 63-75%“Naturally hiding” violations

Goal: Raise Pr(hiding violation) ~ 100%

Page 15: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid Design

Smart chunking Place chunk boundaries deliberately instead of

arbitrarily Try to increase number of hidden atomicity violations

Intuition Observe accesses to some location a Notice unserializable sequence of accesses to a Next time access a, (potentially) “do something”

“Do something” : Add a chunk boundary

Page 16: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid Design Details

Track:Type and address of memory op Read/Write Sets

RC, WC : current chunk

RP, WP : previous chunkRRC, WRC : remote ops while current chunk executingRRP, WRP : remote ops while prior chunk executing

ChunkBreakSetAddresses with past unserializable accesses

Page 17: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid Design Details

Page 18: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid Design Details

Address A is Added to ChunkBreakSetAnother access to A:

Atom-Aid is alerted Decides whether to break a chunk prematurely

Always breaking a chunk doesn’t help

Maintain two conditionsNever break a chunk twiceIf add address to ChunkBreakSet during a

chunk, cannot break that chunk

Page 19: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Chunk Breaking Flowchart

Page 20: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid Implementation

Built on BulkSCThree sets of signatures added

RC, WC : part of BulkSC RP, WP : copy from RC, WC after commitRRC,WRC : remote downgrades, copy from other

processors sigsRRP,WRP : copy from RCP,WCP after commit

ChunkBreakSet: Signature, or cache augmentation

Page 21: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Experimental Setup

Model BulkSC like system using PINResults average over several runs

95% confidence intervals added around average

Explicitly annotate code Begin/end of atomicity-lacking section

Dynamically check if markers within same chunkYes: atomicity violation hidden

Page 22: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Observations

None of the “natural” violations exceeded 1000 instructions

BankAccount2, CircularList2, LogProc&Sweep2 modified to evaluate larger sizes

Page 23: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Workloads

Page 24: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Natural Hiding (no Atom-Aid)

Page 25: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid: Bug Kernels

Page 26: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid: Applications

Page 27: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid: Signature vs Exact

Page 28: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Atom-Aid as a debugger

Record the PC when Atom-Aid inserts a chunk boundary

Group PCs into line of code, function where it appears

Examine functions in order of highestlowest frequency to look for bugs

Page 29: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Time to find bugs

Page 30: Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle

Conclusions

Implicit atomicity can help programmers by preventing bugs from becoming visible

Atom-Aid leverages implicit atomicity via smart chunk boundaries

Atom-Aid can hide almost 100% of atomicity violations