Best choice for messages (std.concurrency)

Russel Winder russel at russel.org.uk
Wed Aug 18 22:35:35 PDT 2010


On Wed, 2010-08-18 at 20:48 +0000, nsf wrote:
> Hi. I'm trying to replicate in D my Go demo app which basically
> draws mandelbrot fractal using multiple goroutines. In Go it's
> fairly easy to communicate between threads, because the memory model
> is C like. D 2.0 on the other hand has this thing "TLS by default".
> And I saw simple examples of std.concurrency usage in Andrei's book,
> but what about more complex ones.

For the little experiments I am doing in D and Go, I am finding that the
solution architectures are surprisingly similar.  Goroutines, channels
and message passing in Go compare to spawning and message passing in D.
Yes the underlying semantics are very different in many ways, but it is
process and message passing as an architectural direction.  In neither
case do I actually care about threads and thread pools, etc.  The whole
point is to get away from shared-memory multithreading as a programming
model and treat it as an enabling model.  Processors, cores and threads
are like memory, heaps and stacks, programmers know they are there, but
they let the runtime system deal with them.

Of course having a sensible parallel algorithm compared to a sequential
algorithm matters, but I am assuming you already have that covered.
-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100819/5b77d2c7/attachment.pgp>


More information about the Digitalmars-d-learn mailing list