2009/3/18 Antony Blakey <antony.blakey@gmail.com>:
On 18/03/2009, at 10:46 PM, Igor Stasenko wrote:
I hear the magic word 'concurrency' .. :) With green threading model we have a kind of concurrency on a language level.. except that its not scaling on to multiple native threads.
The Erlang/Scala/Clojure concurrency models are applicable to a green threads model. Concurrency is difficult even with green threads.
Its not too difficult, i'd say. It is completely different from single threaded approach, so different, that to exploit its benefits you have to deeply rewrite your application(s). And smalltalk is not alone with this problem - many other imperative languages offer nothing in this regard and devs not in a position to get a full grasp of concurrency - they have to reinvent their own wheel first.
There were a lot of discussion around native threading support and everyone agrees that less sharing means less problems.
Which is what such concurrency models provide. I suggest gaining some familiarity with Erlang/Scala/Clojure to protect against Smalltalk- insularity. Yes, i familiar with couple of those. But the problem is, that their employ own concurrency models, which can't be applied directly/blindly to smalltalk. There is always a lot of different nuances who bury the whole idea in the end :)
From this point, running separate object memory per native thread seem most perspective way.
That ties you to only doing large grained concurrency. What if I want thousands of threads, automatically distributed over the available hardware? Are you assuming that concurrency is limited to the number of running images, and each image is strictly single threaded?
In fact you need about 2 * number of cores native threads to have a fully loaded workstation. There is no need to allocate separate native thread for each smalltalk process. All you need is a scheduler which distributing the load between fixed set of native threads.
Concurrency is useful at many different levels of granularity. Using multiple images requires you to use one method for dealing with per- image concurrency (and currently those mechanisms aren't great) and another when considering multiple threads. And what about the tools to make debugging, profiling, deployment, management etc work over these multi-image systems? That might be more work than just biting the bullet and providing scalable concurrency within the image.
You right, but look at bright side: once you implement a remote debugging tool , you can use it for any image located anywhere. And remote debugging is a must for any development environment which claims to be mature one :)
Running single object memory on multiple native threads opens a can of worms. And the complexity of VM implementation will be overwhelming.
Not neccessarily. There may well be legacy issues related to specific VMs and images, but the problem itself is not overwhelming. If it were you wouldn't have the JVM or CLR.
This argument is exactly what I meant when I wrote:
If this were the "good old days"(TM) I'm sure someone would be working on decent concurrency support for Smalltalk. Using multiple images is one approach, but not one that I like - it seems (IMHO) to be a reaction to the lack of resources to do something better.
I would prefer to tackle this problem and do something worthy of Smalltalk's oft-proclaimed awesomeness. Instead we pretend that the multi-image model is actually a good and principled decision - but it's not, it's surrender.
If you familiar with Squeak codebase, there are little applications who tend to care about concurrency. Introducing a native concurrency is pointless without reshaping everything in Squeak from down to up, otherwise you will have no real gains. Having a VM which supports concurrency (GC, foreign calls e.t.c) is about 20% of overall job or less. I don't see how such huge amount of work could be done on a free-time basis. To make it possible, you need a team of dedicated people hired to do the job. So, it is a surrender - but objective one. If someone invest enough money to smalltalk systems it can easily match the JVM/CLR mates.
Antony Blakey ------------- CTO, Linkuistics Pty Ltd Ph: 0438 840 787
In anything at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away. Â -- Antoine de Saint-Exupery
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.