previous |
start |
next
Visualization of Synchronized Thread Behavior
- Imagine the object is a restroom that only one person can use
at a time
- The threads are people
- If the restroom is empty, a person may enter
- If a second person finds the restroom locked, the second person
must wait until it is empty
- If multiple people want to gain access to the restroom , they
all wait outside
- The people may not form an orderly queue;
- A randomly chosen person may gain access when the restroom
becomes available again
previous |
start |
next