On Tue, May 18, 2010 at 3:19 AM, <nigelsande...@btconnect.com> wrote: > The guts of the discussion has been kernel threading (and mutable shared > state) is necessary. The perception being that by using user-threading (on > a single core at a time), you avoid the need for and complexities of > locking and synchronisation. And one of the (I believe spurious) arguments > for the use of user-space (MIMD) threading, is that they are lightweight > which allows you to runs thousands of concurrent threads. > > And it does. I've done it with Erlang right here on my dirt-cheap Intel > Core2 Quad Q6600 processor. But, no matter how hard you try, you can never > push the CPU utilisation above 25%, because those 100,000 user-threads all > run in a single kernel-thread. And that means I waste 75% of my processing > power. And next year (or maybe the spring after), when the lowest spec > Magny-Cours 12-core processor systems have fallen to my 'dirt-cheap' price > point, I'd be wasting 92% of my processing power. > > And for those geneticists and engineers trying to use Perl 6 on their > relatively cheap 48-core boxes to chug through their inherently MIMD > algorithms, they'd be wasting 98% of their CPU power if Perl 6 does not > provide for a threading model that scales across multiple cores. > > I hope that gives some context to a) my misunderstanding of your post; b) > my continued advocacy that kernel threading has to underpin Perl 6's > threading model. > > Java has has user-space threading (green threads) for years; and it was an > ongoing nightmare until they adopted kernels threads in Java 1.5. > Erlang has had user-space threading (coroutines) for years; but they've > had to add kernel threading in the last couple of versions in order to > scale. > IO has had coroutines; but has now added kernel threading in order to > scale.
You are imposing a false dichotomy here. Neither 'green' threads nor kernel threads preclude each other. In fact, it can be convincingly argued that they work _best_ when combined. Please look at the GSoC proposal for hybrid threading on the Parrot list.