literace : effective sampling for lightweight data-race detection

14
Daniel Marino University of California, Los Angeles [email protected] Madanlal Musuvathi Microsoft Research, Redmond [email protected] Satish Narayanasamy University of Michigan, Ann Arbor [email protected]

Upload: amaya-weiss

Post on 31-Dec-2015

28 views

Category:

Documents


1 download

DESCRIPTION

LiteRace : Effective Sampling for Lightweight Data-Race Detection. Guy Martin, OSLab. Agenda. Introduction Background LiteRace Overview LiteRace Implementation Evaluation Limitations Conclusion. Introduction. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: LiteRace : Effective Sampling for Lightweight Data-Race Detection

Daniel MarinoUniversity of California, Los

[email protected]

Madanlal MusuvathiMicrosoft Research,

[email protected]

Satish NarayanasamyUniversity of Michigan, Ann

[email protected]

Page 2: LiteRace : Effective Sampling for Lightweight Data-Race Detection
Page 3: LiteRace : Effective Sampling for Lightweight Data-Race Detection
Page 4: LiteRace : Effective Sampling for Lightweight Data-Race Detection
Page 5: LiteRace : Effective Sampling for Lightweight Data-Race Detection

Lock L

Write X

Unlock L

Thread 1

Thread 2

Lock L

Write X

Unlock L

Time

Lock L

Lock L

Write X

Unlock L

Thread 1

Thread 2

Write X

Unlock L

Time

Lock L

Data race on X

Properly synchronized accesses to a memory location X. No data race

No happens-before relation between the two write operation on location X

Page 6: LiteRace : Effective Sampling for Lightweight Data-Race Detection
Page 7: LiteRace : Effective Sampling for Lightweight Data-Race Detection
Page 8: LiteRace : Effective Sampling for Lightweight Data-Race Detection

Lock L

Write X

Unlock L

Thread 1

Thread 2

Lock L

Write X

Unlock L

Time

Lock L

False data race reported on X

Page 9: LiteRace : Effective Sampling for Lightweight Data-Race Detection

LiteRace Instrumentation

When ColdUsually

Un-instrumented copy

Instrumented copy

Page 10: LiteRace : Effective Sampling for Lightweight Data-Race Detection

Dispatch FunctionDecrement the Sampling

Counter

Sampling

Counter = 0 ?

Un-instrumented

functionOriginal code + log synchr. ops

NO

Instrumented function

Original code + log synchr. & memory ops

Sampling Counter

Is set to a new value based on

current sampling rate

YES

SynchronizatiSynchronization Operationon Operation

SyncVarSyncVar AdditionAdditional Sync?al Sync?

Lock/UnlockLock/Unlock Lock Object Lock Object AddressAddress

NONO

Wait/NotifyWait/Notify Event HandleEvent Handle NONO

Fork/JoinFork/Join Child Thread IdChild Thread Id NONO

Atomic Machine Atomic Machine OperationsOperations

Target Memory Target Memory AddressAddress

YESYES

LiteRace Code Instrumentation

Happens-before relation tracing

Page 11: LiteRace : Effective Sampling for Lightweight Data-Race Detection

Synchronization Synchronization OperationOperation

ActionAction

Lock/UnlockLock/Unlock The timestamp is logged and incremented The timestamp is logged and incremented after a Lock and before an Unlockafter a Lock and before an Unlock

Wait/NotifyWait/Notify The timestamp is incremented and logged The timestamp is incremented and logged before the Notify operation and after the Wait before the Notify operation and after the Wait operationoperation

Fork/JoinFork/Join The timestamp is incremented and logged The timestamp is incremented and logged before the Join operation and after the Fork before the Join operation and after the Fork operationoperation

Atomic Machine Atomic Machine OperationsOperations

Additional synchronization are added to Additional synchronization are added to guarantee atomic timestampingguarantee atomic timestamping

ts1

ts2

ts3

ts4

T1 T2It’s guaranteed that an Unlock operation on a particular mutex will have a smaller timestamp than a subsequent Lock operation on that same mutex in another thread.

<

Page 12: LiteRace : Effective Sampling for Lightweight Data-Race Detection
Page 13: LiteRace : Effective Sampling for Lightweight Data-Race Detection
Page 14: LiteRace : Effective Sampling for Lightweight Data-Race Detection