Simon Peyton-Jones wrote:
> I think what you want is a distributed way to get a unique,
> as George suggested. Then you can pair that with an MVar when
> you want something comparable. The unique can include the processor
> id, so it can be globally unique. 64 bits?
>
> I'm still leery of putting such a unique inside every MVar, IORef etc.
> But maybe I shouldn't worry.
I think you should worry . . .
No-one has yet come up with a convincing satisfactory solution to the
original problem. In my view solutions should not ever
(1) deadlock
(2) loop for ever
(3) use global state (directly via unsafePerformIO, or indirectly
via the global random number generator.)
I think I know why. Imagine two processors.
Processor 1 creates flag 1 and sends it Processor 2.
Processor 1 receives flag 2 from Processor 2.
Processor 1 calls
lowerFlags (flag1) (flag2)
Exactly the same happens at the same time to Processor 2.
Now somehow you have to distinguish between Processor 1 and Processor 2,
because only one is going to get to lower the flags. But I don't think
with the existing Concurrency extensions plus standard Haskell you can.
Does the phrase "Dining Philosophers Problem" ring a bell with anyone?
- Re: Trivial Haskell Concurrency problem Michael Hobbs
- Re: Trivial Haskell Concurrency problem George Russell
- RE: Trivial Haskell Concurrency problem Simon Peyton-Jones
- Re: Trivial Haskell Concurrency problem George Russell
- Re: Trivial Haskell Concurrency problem Wolfram Kahl
- Re: Trivial Haskell Concurrency problem Marcin 'Qrczak' Kowalczyk
- Re: Trivial Haskell Concurrency problem George Russell
- RE: Trivial Haskell Concurrency problem Simon Peyton-Jones
- Re: Trivial Haskell Concurrency problem Wolfram Kahl
- Re: Trivial Haskell Concurrency problem George Russell
- Re: Trivial Haskell Concurrency problem George Russell
- Re: Trivial Haskell Concurrency problem Michael Hobbs
- Re: Trivial Haskell Concurrency problem Marcin 'Qrczak' Kowalczyk
- Re: Trivial Haskell Concurrency problem George Russell
- Re: Trivial Haskell Concurrency problem Tom Pledger
- Re: Trivial Haskell Concurrency problem Marcin 'Qrczak' Kowalczyk
- Re: Trivial Haskell Concurrency problem George Russell
- Re: Trivial Haskell Concurrency problem George Russell
- Re: Trivial Haskell Concurrency problem Tom Pledger
- Re: Trivial Haskell Concurrency problem Marcin 'Qrczak' Kowalczyk
- Re: Trivial Haskell Concurrency problem George Russell
