Lots of concurrency
Richard A. O'Keefe
ok at atlas.otago.ac.nz
Tue Oct 23 03:47:15 UTC 2001
David Chase <chase at world.std.com>, with whom it is usually
extremely hard to disagree, wrote:
Perhaps this is heresy, but it might not hurt to study what
Java has in the way of concurrency support, and perhaps to
compare it with Modula-3.
I would very much like to agree with him, but can only do so by
interpreting "study what Java has" in the sense "learn what to avoid".
In Java:
- Sun implemented a number of methods which they then had to ask
people not to use
- EVERY object can be synchronised, which means that you have to have
extremely smart, not to say tricky, implementation techniques or
else make every object pay the full price of having a lock.
- the synchronised method stuff makes operations like "Vector.indexOf"
work, in that changes to the vector will not be allowed while the
search is proceeding, BUT
- this tempts programmers to rely on it, and
i = vec.indexOf(x);
y = vec.elementAt(i);
does NOT implement y.equals(x).
In order to deal reliably with things like Vectors, you find yourself
needing to put new synchronised methods into Vector, but you aren't
allowed to do that.
Another OO language where concurrency _did_ receive serious thought
is Dylan.
More information about the Squeak-dev
mailing list
|