2
$\begingroup$

How to find the depth of a concurrency bug

The below program runs on two separate threads and shares the variable x. Variables t1 and t2 are local to their threads. The program has a concurrency bug in it.

Bug: Any time both threads perform a read before they write we loose an update to x.

Thread 1

 1. t1=x
 2. t1=t1+1
 3. x=t1

Thread 2

 1. t2=x
 2. t2=t2+1
 3. x=t2

I am told the depth of the bug is 2. My question is what is the process to find the depth of a concurrency bug?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.