[A complimentary Cc of this posting was sent to
Ben Morrow
Of course he is. Given Ilya's previous posts of the evils of fork(),
it is unsurprising he dislikes ithreads.
Myself, I do not see any connection between these two acts of madness.
Introducing fork() *was* an act of madness in '70; however, today,
when (on Unix) most problems associated with this madness are either
already resolved, or at least well understood, most it deserves is
just a shrug. [Of course, outside of Unix it provides enormous
difficulties to developers, but for the purpose of simiplicity, I
would like to keep the discussion of ithreads focused on one
architecture only.]
The fact that "fork() emulation on Win32" is related to fork() has
little to do with the problem of ithreads. Consider the code to
perform emulation as a black box. It is just a subsystem of Perl
which does "something".
Now somebody got a bright idea: "running this subsystem on Unix will
give us an interpreter running in a new thread; code reuse is a good
thing; let us just use this subsystem to create new threads."
"BTW, a lot of people had problems with running the old model of
threads. We care; let us remove the support for the old model, so
people do not have these problems."
Now we got a system which uses a microscope to pull nails. The
microscope does not care, but the finishing is all ruined.
I have to admit, it seems rather daft to attempt to reimplement in
perl something which the OS does perfectly well; except on those
OSen which don't. I have serious doubts that ithread creation will
ever become less expensive than process creation on a decent unix,
simply because they are essentially the same operation.
Are you joking? Did you read the code for fork() emulation? Did you
run any benchmarks? The code is 2 orders of magnitude slower than
process creation.
Try to create 20 ithreads/sec; it may be possible on very recent
hardware, but I think it is close to the current maximum...
Hope this helps,
Ilya