Avi Bryant wrote:
Glenn Parker wrote:
Yes, I want synchronous I/O and true multi-cpu execution.
And shared memory - right?
Of course, otherwise threads are no more interesting than (heavy-weight) processes.
Because with Ruby or Smalltalk, there's
nothing stopping you from using multiple CPUs by having multiple
instances of the VM, communicating through DRb or whatever.
Right, nothing except the overhead and occasional confusion that results from passing objects between processes.
The engineers that build their networking and database
systems always claim that the green threads scale much, much better -
porting such code from VisualWorks to ObjectStudio always involves a
lot of headaches in getting it to perform decently under the
disadvantage of native threads.
Yup, I've been there (using C++, not Smalltalk). If you write code assuming that you have "unlimited" threads (which green-style threads encourages), some OS threading implementations will really knock you flat on your kiester. If you can redesign to treat threads as limited resources (more like processes), native threads excell. I'm not saying one threading style is necessarily "better", they each have their place and they each require compromises.
The best setup would probably be to have many green threads to each (of
multiple) native thread, but that's a huge engineering effort.
Sort of like what Solaris already did, and rather nicely at that. Sadly, nobody followed in their tracks, or I would have had a lot less code to redesign.
I think
Matz made the right decision: keep things simple and under the direct
control of the VM.
I assert that a VM can be threaded and still maintain direct control, it just won't be quite as simple.
···
--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoil.com/>