www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - fibers/coroutines tutorial?

reply "Hasan" <hasan.aljudy gmail.com> writes:
Is there a quick tutorial/intro for what D offers as an 
equivalent or alternative to "goroutines"?

I've seen the concurrency link on the homepage .. and umm .. call 
me lazy but I don't feel like reading through all that just to 
see what D's alternative to goroutines looks like ..
Jan 24 2014
next sibling parent "Dejan Lekic" <dejan.lekic gmail.com> writes:
On Friday, 24 January 2014 at 16:02:27 UTC, Hasan wrote:
 Is there a quick tutorial/intro for what D offers as an 
 equivalent or alternative to "goroutines"?

 I've seen the concurrency link on the homepage .. and umm .. 
 call me lazy but I don't feel like reading through all that 
 just to see what D's alternative to goroutines looks like ..
Yes, and it is listed on http://wiki.dlang.org . Please go to articles/tutorials part of that web-site and enjoy really good reads.
Jan 24 2014
prev sibling next sibling parent "Dicebot" <public dicebot.lv> writes:
On Friday, 24 January 2014 at 16:02:27 UTC, Hasan wrote:
 Is there a quick tutorial/intro for what D offers as an 
 equivalent or alternative to "goroutines"?

 I've seen the concurrency link on the homepage .. and umm .. 
 call me lazy but I don't feel like reading through all that 
 just to see what D's alternative to goroutines looks like ..
Well if you really want to skip everything and go straight to code, it is all about fibers : http://dlang.org/phobos/core_thread.html#.Fiber
Jan 24 2014
prev sibling parent Russel Winder <russel winder.org.uk> writes:
On Fri, 2014-01-24 at 16:02 +0000, Hasan wrote:
 Is there a quick tutorial/intro for what D offers as an 
 equivalent or alternative to "goroutines"?
 
 I've seen the concurrency link on the homepage .. and umm .. call 
 me lazy but I don't feel like reading through all that just to 
 see what D's alternative to goroutines looks like ..
Now that is just bad research ;-) As far as I am aware D has no equivalent of Go's goroutines per se. A goroutine is (well should be) a process with no access to any global shared memory, with channels with which to communicate to other goroutines. Effectively Go realizes Communicating Sequential Processes (CSP), not 1978 style, but about 2009 style. D's built-in concurrency/parallelism supports is much more akin to actors. D would be improved by having a realization of CSP to augment what it already has. For now though you would have to build a CSP-style system over the actor-style system, though this would have inefficiencies. The problem will be how to realize the select operation. For now the only realizations of CSP that I am aware of that are usable are Go, PyCSP, PythonCSP, JCSP, GroovyCSP, C++CSP2. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Jan 24 2014