Copyright © 2001 Qusay H. Mahmoud
16
Pitfalls of Threads
lIf Alice and Bob are executing the code segment simultaneously, we get:
l
        Alice
            Bob
         Balance
If (80 - 50 >= 0)
     If (80 - 70 >= 0)
Balance = Balance - 50
Balance = Balance - 70
 
 80
80
30
-40