[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Insecure parallelism with Java?]



Since I initially botched the java-threads address in my post to the
kaffe listserv, I am forwarding this reply, which I received from a
kaffe community member (and developer, I think).

Roy Wilson
designrw@xxxxxxxxxxxxxxxx
--- Begin Message ---

Yes, Java does not have "monitors" as Dijkstra/Hoare/Hansen invented them,
that is, shared variables are not by design enclosed in monitors.
It is possible to access shared variables in an unsafe way, as anybody
who's done some Java programming knows.

To my knowledge, people have not demonstrated an efficient alternative 
that would make it safe - the obvious way, designing a language that would
eliminate unsafe concurrent access, so far seems to be regarded as
leading to inefficient implementations because it requires excessive 
synchronization.

Personally, I think the jury is still out.  There is some promising work
that tries to eliminate unnecessary synchronization in Java, for instance
via static analysis at the bytecode level.  VM implementors also employ
various tricks to make acquiring uncontended locks (the common case)
cheap, and to optimize recursive lock acquisition.  It's not unreasonable 
to expect substantial improvements here during the next years. 

	- Godmar

> 
> 
> Hi,
>     I apologize in advance for posting "philosophy" on this site. Having said that
> ...
>     I recently came across a paper in the April 1999 issue of the ACM SIGPLAN
> Notices. In it, after claiming priority of invention in connection with monitors,
> Per Brinch Hansen says the following: "The claim that Java supports monitors is
> shown to be false". As a result, he says, "parallel threads can access shared
> variables, either directly or indirectly, without any synchronization". Somewhat
> (?!?) provocatively, he finishes up with the following: "It is astounding to me that
> Java's insecure parallelism is taken seriously by the programming community .... It
> has no merit." Pretty strong stuff, eh?
>     As I am writing an application that centres on Java concurrency, I'm interested
> in what experts of various types make of this, especially those involved in building
> JVMs.
> 


--- End Message ---