[m-dev.] for review: stream I/O

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Oct 3 01:14:38 AEDT 2000


On 02-Oct-2000, Peter Ross <petdr at miscrit.be> wrote:
> I think that the only way a total ordering can be enforced is by
> including an io__state pair for every stream operation which could
> modify the external world.

I think you're right.  But file locking is another way to make sure
that the results are deterministic: it doesn't ensure that
there is a total ordering on accesses to different files, but by
preventing concurrent access to the same file it ensures that the
ordering doesn't matter.

> On Mon, Oct 02, 2000 at 03:56:11AM -0700, Ralph Becket wrote:
> > Of course, there are other times when it is positively
> > advantageous not to enforce an ordering (e.g. in a program that
> > reads concurrently from two different files).
>
> In this case you can always explicitly spawn a seperate thread to
> do the IO, if you adopted the above solution.

Yes, but then things become `cc_multi'.
The locking solution gives deterministic parallelism
without the drawbacks of unspecified behaviour that
you get with `cc_multi'.
Each have their advantages and disadvantages.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list