On Tue, Dec 31, 2013 at 7:07 PM, Carter Schonwald
<carter.schonw...@gmail.com> wrote:
> For the sake of concreteness, what would be an example of the live lock
> scenario?

Suppose we have two channels, c1 and c2, and they are both full. The
deadlock scenario is where task 1 won't read from c2 until it can send
to c1, and task 2 won't read from c1 until it can send to c2. So both
of them won't read until they write, but they can't write until the
other reads.

The livelock scenario replaces foo.send() in the blocking model, with
while foo.send() {} (i.e. continuously retries sending until success).

Probably in real life the livelock is much more subtle than this. I've
personally never encountered a deadlock that was subtle (finding out
which thread is blocking on what is trivial, and deducing the deadlock
from that is just a matter of understanding the relationships between
the semaphores), so I'm not sure that it's actually better to replace
blocking channels because of deadlocks. However, I'm not a Serious
Programmer who deals a lot with concurrency, so maybe my intuition is
wrong or I haven't seen the right problems yet.

-- Devin
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to