There are multiple possible final states. Y is definitely a problem, because we don’t know if it will be “1” or “7”… but X can also be 7, 10, or 11!
Inform students that the term we want here is “race condition”
Ask: are there still any problems? (Yes – we still have two possible outcomes. We want some other system that allows us to serialize access on an event.)
Go over wait() / notify() / broadcast() --- must be combined with a semaphore!
0 comments
Post a comment