News for hackers. Stuff that matters.
Re:Implementing Queues for Event-Driven Programs by heavenlyhash on Monday June 13, 2016 @12:09PM (#11894994)
> In the extreme cases (and ultra-small sizes like 2 or 3), we can even run into deadlocks (!).

If this happens to you, you're doing it wrong. You have deadlocks; they just aren't happening "usually" unless you're "unlucky"... but happen they will!

Build your program to run correctly when all queues are buffer size of 1. If it doesn't work, you're doing it wrong.

Now raise the buffer sizes to something reasonable to reduce the performance frictions of too-strict scheduling. You will never have deadlocks.

Re:Implementing Queues for Event-Driven Programs by jcbeard on Monday June 13, 2016 @01:45PM (#11895710)
Agreed. If having deadlocks, then there's likely a cyclic dependency the programmer/author didn't consider. This happens a lot in streaming/data-flow code. Worse, something in the queue that's wonky. Seems to happen on multi-arch lockless FIFO's when the authors didn't consider corner cases of architectures with more relaxed coherence, or architected features (e.g., 128 vs. 64-byte cache lines).
Re:Implementing Queues for Event-Driven Programs by no-bugs on Monday June 13, 2016 @02:11PM (#11895907)
> If this happens to you, you're doing it wrong.

Except for some corner cases - you're right, probably I should add a note about it...