On Wed Oct 28 05:42:25 EDT 2009, [email protected] wrote: > it isn't protecting against double wakeups, but > instead detects a bug in the code. there's an invariant > that the rendez and the process point to each other > while the process is asleep. > wakeup checks that invariant. > there are three primitives (sleep, wakeup and note) > and at different times in the past at least one of them > has been wrong; it's wise to check the invariant. > > >and only disallows waking up a process that's not > >sleeping or sleeping on another Rendez. > > but wakeup doesn't wakeup a particular process, it > wakes up exactly the process sleeping on the given Rendez, > so the situation can't arise.
i agree that it's wise to check invariants. however the invarient that there is exactly one wakeup for every sleep requires some careful accounting that can be equally error prone. the case i'm worried about is when two or more kprocs think (perhaps for independent reasons) they need to wakeup a Rendez. it would seem to me less error prone (and faster) for wakeup to allow this race and do nothing. e.g., the interrupt routines of, e.g. 82563 and igbe take particular care not to double-interrupt. this requires some extra rts across the pci/pcie bus. - erik
