previous |
start |
next
Race Condition Scenario
- First thread calls add and executes
elements[tail] =
anObject;
- First thread at end of time slice
- Second thread calls add and executes
elements[tail] =
anObject;
tail++;
- Second thread at end of time slice
- First thread executes
tail++;
previous |
start |
next