Processes and Channels, cf. goroutines.

Bienlein jeti789 at web.de
Tue Feb 4 01:37:15 PST 2014


On Tuesday, 28 January 2014 at 17:25:35 UTC, Russel Winder wrote:
> It seems goroutine like process and channels are coming to C++:
> https://github.com/ahorn/cpp-channel


This is interesting, but you can bring that sort of approach to 
some other language as well. Here is a simple approach to get it 
done for Java: 
http://java.dzone.com/articles/go-style-goroutines-java-and. What 
is hard to implement without support from the language is the 
CSP-style channel select, which delivers a lot of the power of 
channels in Go.

Also, without green threads as in Go there is no way to spawn 
some hundred thousand threads as in Go. Java will start to get 
into its knees after some thousand threads already depending on 
how much resources are available to the machine. You can work 
around this by having a pool of threads process tasks added to 
queues where the number of queues can become very large. But when 
your thread pool has n threads and for an overlapping time window 
you have n long-runners being executed all other tasks are stuck 
till the first long runner has finished execution.

Green threads and CSP-style channels is what keeps a lot of 
people with Go as the rest of the language is almost simplistic. 
What I would really like to have is D with Go's green threads 
along with channels and channel select. Some people would now 
smile mildly, but for today's load on servers there is a real 
necessity. For example read this article "How We Went from 30 
Servers to 2: Go". Link: 
http://blog.iron.io/2013/03/how-we-went-from-30-servers-to-2-go.html

Regards, Bienlein


More information about the Digitalmars-d mailing list