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.
1. t1=x 2. t1=t1+1 3. x=t1
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?