threading

Sturla Molden sturla.molden at gmail.com
Tue Apr 8 11:44:29 EDT 2014


Roy Smith <roy at panix.com> wrote:

> Thread 1 and Thread 2 use a pair of queues to communicate.  T1 sends 
> work to T2 using Q1, and T2 sends back results using Q2.
> 
> T1 pushes Item1 onto Q1, and waits for Result1 to come back on Q2.
> 
> T2 reads Item1 from its end of Q1, and waits to read Item2, which it 
> needs to compute Result1.
> 
> Sounds like a deadlock to me.

As it turns out, if you try hard enough, you can always construct a race
condition, deadlock or a livelock. If you need to guard against it, there
is paradigms like BSP, but not everything fits in. a BSP design.

Sturla




More information about the Python-list mailing list