2 ms·
Yeah, I don't get this either, and none of the downstream comments clarify this for me. In a FIFO system, all of the fast processes acquire the lock before the
by lisper 7y ago
Yeah, I don't get this either, and none of the downstream comments clarify this for me. In a FIFO system, all of the fast processes acquire the lock before the slow process comes up again in the queue. With random dispatch, the slow process will re-acquire the lock while some of the fast processes are still waiting. So I don't see how this can possibly do anything but make the situation even worse than it was.
- tbrownaw 7y agoOne possibility is if it's not about inherently "fast" or "slow" processes. Suppose all of the processes are doing very similar asynchronous or network I/O, and need the lock at roughly set wall-clock intervals. Say 100ms, to have numbers to play with. In that case, you can dequeue something that's been waiting for 90ms and it will re-enqueue itself after another 10ms, or you can dequeue something that's been waiting for 10ms and it won't re-enqueue itself for another 90ms. In which case, FIFO would mean that processes are doing more of their waiting in the lock queue (and being woken up every time the lock changes hands), while LIFO or random order would put more of their wait time blocked on IO. Random wouldn't be as good as LIFO, but it wouldn't have nearly as high a risk of starvation.