The recent IEEE Computer society magazine ‘Computer’ May 2006 has a
thought-provoking article on threading and concurrency (p. 33).
The author has three points:
Threading is an error prone method of parallelizing a program.
Basically, his thesis is that thread packages support non-deterministic
coding and then adds methods of constraining the non-determinism, and
that such methods are brain-twistingly difficult to write and read,
difficult to test, and have latent bugs that don’t appear for years
which are correspondingly impossible to duplicate.
Better methods of expressing concurrency exist, have been implemented
in many obscure languages, and still don’t have mainstream acceptance.
The author advocates use of ‘coordination’ or ‘composition’ languages
on top of existing general purpose languages to express concurrency.
These coordination languages still have a lot of work yet to be done. My
thought is perhaps Ruby can express concurrency cleanly without
needing another language.
I thought this idea might appeal to Matz, language-aficionado that he
is, and that Ruby has demonstrated with Rake and Rails that not having
multiple languages in a development environment has benefits.
My point in posting this message is to ask the Ruby community if it is
worth thinking about laying some foundations in Ruby 2.0 and YARV to
elegantly support other methods of expressing concurrency. Perhaps this
work won’t show results until Ruby 3.0, but reserving some keywords in
the grammar and some hooks in the VM may yield dividends in the future.
It is clear to me that single processor machines are becoming quaint,
and that the new norm in desktop machines will be multi-core, multi-chip
SMP and NUMA machines along with clusters for servers.
In this new environment, if Ruby can seamlessly and cleanly take
advantage of available concurrent resources, it will be a huge win for
Ruby over other popular languages. My hope is that the Ruby VM will take
care of each architecture’s concurrency ugliness behind the scenes,
leaving the fun stuff in front.
Yes, I’m posting this essentially anonymously. I’m new to Ruby, and
rusty at coding and threading. I’m intrigued by the idea of having fun
again and I want Ruby to be the best language it can be. I did search
the archives for discussions of concurrency and parallelism - I didn’t
find very much. I also want to be able to attend Ruby events without
needing a paper bag on my head if it turns out that this is a pointless
post. I trust the community won’t flame me too badly.