Scenario with Locks
- First thread calls add and acquires lock, then executes
elements[tail] = anObject;
- Second thread calls add and tries to acquire lock, but
it is blocked
- First thread executes
tail++;
- First thread completes add, releases lock
- Second thread unblocked
- Second thread acquires lock, starts executing protected code