On Sun, Sep 6, 2015 at 9:12 PM, Peter Dimov
Giovanni Piero Deretta wrote:
Waiters are waken up in FIFO order (at least under realtime FIFO scheduling), but if the signaling is done outside the critical section, a late thread might acquire the critical section (and consume a resource) after the condition as become true, but before older waiters had a chance to acquire it. This might be particularly important with realtime systems.
That's typically what one wants for performance though (absent special FIFO requirements), as that late thread is running (has a CPU) and has its cache hot.
Yes of course, on a normal application, for performance normally you want that, but on a realtime system the constraints are different. For example the late thread might have lower priority than the currently blocked threads. -- gpd