www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Joe Duffy's "Thoughts on immutability and concurrency"

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
This blog entry looks interesting:

http://www.bluebytesoftware.com/blog/PermaLink,guid,7a57f623-d65d-4212-973d-29bdcf61dd3a.aspx

Andrei
Jul 28 2010
parent reply Jesse Phillips <jessekphillips+D gmail.com> writes:
Andrei Alexandrescu Wrote:

 This blog entry looks interesting:
 
 http://www.bluebytesoftware.com/blog/PermaLink,guid,7a57f623-d65d-4212-973d-29bdcf61dd3a.aspx
 
 Andrei

I must not be understanding something in his use of immutability. For his spellchecker example he suggested making a copy of some portion of the document into an immutable data-structure so that it can be shared without locks or copying. How is this better than message passing of mutable data? I suppose you can then pass this immutable structure to a spellchecker, grammar analyzer, and a haiku generator without multiple memory copies? In which case you're still assuming shared memory across threads or programs.
Jul 28 2010
parent reply bearophile <bearophileHUGS lycos.com> writes:
Jesse Phillips:
 I must not be understanding something in his use of immutability. For his
spellchecker example he suggested making a copy of some portion of the document
into an immutable data-structure so that it can be shared without locks or
copying. How is this better than message passing of mutable data?

To know the answer you need to know what a piece-table is, here you can find some info: http://www.cs.unm.edu/~crowley/papers/sds/node15.html You can find the missing images here: http://www.cs.unm.edu/~crowley/papers/sds.pdf Bye, bearophile
Jul 28 2010
parent Jesse Phillips <jessekphillips+D gmail.com> writes:
bearophile Wrote:

 Jesse Phillips:
 I must not be understanding something in his use of immutability. For his
spellchecker example he suggested making a copy of some portion of the document
into an immutable data-structure so that it can be shared without locks or
copying. How is this better than message passing of mutable data?

To know the answer you need to know what a piece-table is, here you can find some info: http://www.cs.unm.edu/~crowley/papers/sds/node15.html You can find the missing images here: http://www.cs.unm.edu/~crowley/papers/sds.pdf Bye, bearophile

Forgot to look that up after I had finished the article. Thanks for the links.
Jul 28 2010