| Thread 1 | Thread 2 |
| deposit(50) | |
| compute 'balance+amt' | |
| deposit(50) | |
| compute 'balance+amt' | |
| balance=50 | |
| balance=50 | |
| withdraw(100) -> insufficient funds |
| Thread 1 | Thread 2 |
| withdraw(50) | |
| if(amt>balance) -> false | |
| withdraw(50) | |
| if(amt>balance) -> false | |
| balance-=50 | |
| balance-=50 |