Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Designing complex Haskell programs (Daniel Trstenjak)
2. Re: Designing complex Haskell programs (Courtney Robinson)
----------------------------------------------------------------------
Message: 1
Date: Tue, 14 Jan 2014 13:23:16 +0100
From: Daniel Trstenjak <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Designing complex Haskell programs
Message-ID: <20140114122316.GA16351@machine>
Content-Type: text/plain; charset=us-ascii
Hi AntC,
> Out of interest, is there some reason you don't mention TVar's?
The use case here seemed to be more about having shared data which is
only read most of the time and updated occasionally. So the MVar seems
to be a quite good fit for this.
> I thought they are the (modern) way to "build robust systems"
> with "different threads using forkIO"(?)
I think it really depends how your threads are accessing the shared
data. Sometimes the rollbacks of a STM might hurt you more than
waiting for the lock of a MVar.
You could use a TVar here, but you have to be aware, that your
threads might operate on outdated data - if one thread is currently
updating the data - and this might be an issue for your system.
If I'm getting it correctly, then a MVar can't be read by mutliple
threads at once, even if all threads are only reading from it.
That's an advantage of the TVar.
So thinking again about it, having only occasionally writes from
favorably only one thread and reads from multiple threads, then indeed
the TVar might be a quite good fit for this use case.
Greetings,
Daniel
------------------------------
Message: 2
Date: Tue, 14 Jan 2014 17:24:53 +0000
From: Courtney Robinson <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Designing complex Haskell programs
Message-ID:
<cago6xjbme7ea+umltzqo+petux4ts6a0ntpnl05_kyxtzoc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
In my case I don't really care which version of the data a thread sees,
from the apps point of view the data is correct at the time it is fetched.
I was playing around with this idea and it's actually what the
multi-version concurrency control technique was developed for* (more or
less anyway).
I ended up writing http://hackage.haskell.org/package/Stasis to experiment
with using an MVCC style in Haskell.
Docs aren't currently being built on hackage, trying to figure out why but
have a look at the source on github to see what I was thinking
On Tue, Jan 14, 2014 at 12:23 PM, Daniel Trstenjak <
[email protected]> wrote:
>
> Hi AntC,
>
> > Out of interest, is there some reason you don't mention TVar's?
>
> The use case here seemed to be more about having shared data which is
> only read most of the time and updated occasionally. So the MVar seems
> to be a quite good fit for this.
>
> > I thought they are the (modern) way to "build robust systems"
> > with "different threads using forkIO"(?)
>
> I think it really depends how your threads are accessing the shared
> data. Sometimes the rollbacks of a STM might hurt you more than
> waiting for the lock of a MVar.
>
> You could use a TVar here, but you have to be aware, that your
> threads might operate on outdated data - if one thread is currently
> updating the data - and this might be an issue for your system.
>
> If I'm getting it correctly, then a MVar can't be read by mutliple
> threads at once, even if all threads are only reading from it.
> That's an advantage of the TVar.
>
> So thinking again about it, having only occasionally writes from
> favorably only one thread and reads from multiple threads, then indeed
> the TVar might be a quite good fit for this use case.
>
>
> Greetings,
> Daniel
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
--
Courtney Robinson
[email protected]
http://crlog.info
07535691628 (No private #s)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140114/63952640/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 67, Issue 18
*****************************************