[Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators
marlowsd at gmail.com
Mon May 16 11:56:02 CEST 2011
On 13/05/2011 21:12, Bernie Pope wrote:
> On 13 May 2011 19:06, Simon Marlow <marlowsd at gmail.com
> <mailto:marlowsd at gmail.com>> wrote:
> As far as memory consistency goes, we claim to provide sequential
> consistency for IORef and IOArray operations, but not for peeks and
> Hi Simon,
> Could you please point me to more information about the sequential
> consistency of IORefs? I was looking for something about this recently
> but couldn't find it. I don't see anything in the Haddock for Data.IORef.
Yes, it's not actually documented as far as I know, and we should fix
that. But if you think about it, sequential consistency is really the
only sensible policy: suppose one processor creates a heap object and
writes a reference to it in the IORef, then another processor reads the
IORef. The writes that created the heap object must be visible to the
second processor, otherwise it will encounter uninitialised memory and
crash. So sequential consistency is necessary to ensure concurrent
programs can't crash.
Now perhaps it's possible to have a relaxed memory model that provides
the no-crashes guarantee but still allows IORef writes to be reordered
(e.g. some kind of causal consistency). That might be important if
there is some processor arcitecture that provides that memory model, but
as far as I know there isn't.
For some background there was a discussion about this on the
haskell-prime mailing list a few years ago, I think.
More information about the Haskell-Cafe