literace : effective sampling for lightweight data-race detection
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 PresentationTRANSCRIPT
Daniel MarinoUniversity of California, Los
Madanlal MusuvathiMicrosoft Research,
Satish NarayanasamyUniversity of Michigan, Ann
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
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
LiteRace Instrumentation
When ColdUsually
Un-instrumented copy
Instrumented copy
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
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.
<