D vs Go in real life

Russel Winder russel at winder.org.uk
Wed Nov 6 05:31:34 PST 2013


On Wed, 2013-11-06 at 11:10 +0100, Bienlein wrote:
[…]
> I'm sure about that. When you block a thread in Java it is no
> longer available for the thread pool and increasing the size of
> it cannot be done at will, because creating new threads is not
> lightweigt on the JVM.

Anyone using thread management explicitly in Java is doing it wrong. The
one thing Go has totally right is "share data by passing messages" (*),
even the functional programming community know this one.

Kernel threads are not lightweight on any system, hence threads pools
and fibres (**).
    
> There is a CSP implemention for Java made by some English
> university: http://www.cs.kent.ac.uk/projects/ofa/jcsp/ Groovy
> CSP makes use of it:
> http://www.gpars.org/1.0.0/guide/guide/GroovyCSP.html But I
> haven't tried what happens when you block threads.

JCSP has many problems, not least it hasn't been formally released in
eons. People are still working on it but their concerns are academic
focussed rather than production focussed. Long story elided.

Groovy CSP is an integral part of GPars, but Václav Pech and I have been
wanting to create a new CSP realization in GPars directly rather than
using JCSP as a delegate. Sadly neither of us have the time these days.

The whole idea of even knowing about threads when using CSP, especially
Groovy CSP, and GPars in general, is total anathema. The whole point is
that the comutational model is about messages and the events they cause.
Threads are a hidden animating infrastructure. Programmers working with
CSP should never think about threads.





(*) There are some reasonable exceptions, but they are fewer and further
between than most people think.

(**) Which are really just threads from the 1970s and 1980s.

-- 
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 winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list