Recitation3
-
According to the lockset algorithm, when does eraser signal a data race? Why is this condition chosen?
a. When the candidate locks C(v) for v become empty.
b. Because when it becomes empty, it means there are at least two threads accessing v without holding same lock(s), indicating that there is no lock that consistently protects v.
-
Under what conditions does Eraser report a false positive? What conditions does it produce false negatives?
a. false positive:
- Memory Reuse. False alarms were reported because memory is reused without resetting the shadow memory.
- Private locks. False alarms were reported because locks are taken without communicating this information to the Eraser at runtime.
- Benign race. True data races were found that did not affect the correctness of the program.
- Post/Wait style synchronization in OS kernels For instance, because semaphores are not “owned” it is difficult for Eraser to infer which data they are being used to protect, leading it to issue false alarms.
- Multiple readers When multiple readers read a shared variable without holding same locks, it will cause false alarm.
b. false negatives:
-
Multiple protecting locks. Each of two readers could access the location while holding two different locks.
On each read of v by thread t, if C(v) 5 { }, then issue a warning. On each write of v by thread t, set C(v) :5 C(v) ù locks held(t); if C(v) 5 { }, then issue a warning.
In this version of lockset algorithm, it is possible to cause false negatives.
For example, if a thread t1 reads v while holding lock m1, and a thread t2 writes v while holding lock m2 , the violation of the locking discipline will be reported only if the write precedes the read.
It causes false negative when the read precedes the write.
-
Typically, instrumenting a program changes the intra-thread timing (the paper calls it interleaving). This can cause bugs to disappear when you start trying to find them. What aspect of the Eraser design mitigates this problem?
It can inline monitoring code to eliminate the overhead of making procedure call at every load and store instruction.