const

Georg Wrede georg at nospam.org
Thu Mar 27 20:42:04 PDT 2008


Walter Bright wrote:
> People were doing multiprogramming with Java from the beginning. That's 
> why it has synchronized functions, volatile, etc. The thing is, we have 
> 10 more years of experience with what works and what doesn't work with 
> multiprogramming, so we can do a much better job.

At the time I never thought of multiple CPUs. Looks like "neither did 
they". Nothing in the examples or discussions specifically led one to 
think we're actually talking about several processors. (I guess it may 
have been implied, but in that case the thought would've been that 
that'll come in the "distant" future.)

Somehow the thought was that one should consider multithreading as if it 
happened on several processors, but that in "reality" it'll be 
implemented on a single processor just hopping between the threads -- 
not that you should make big deal about it: the code you write should 
still be the same anyway.

For that, using Java's Synchronized etc., seemed adequate, both for a 
1-CPU and for an N-CPU hardware. But what they should have done is 
really investigate the issues /between/ multithreading and 
multiprocessor scenarios. And precisely that should have been easy with 
the multi-virtual-CPU-Java-VM. And given then the head start they'd needed.

While I'm at it, in the late '90s, I organised a Java seminar in 
Lapland. I got some of the best academic and free-lance speakers 
available, to speak on Advanced Java Concepts to the best programmers in 
several of the largest corporations around, while still addressing the 
audience as if they hadn't too many years of Java experience. (Which 
they couldn't have since Java had only _been_around_ for a couple of years.)

One of the lectures I'll never forget was about multithreading and 
Objects. While I in theory knew about multithreading, OOP, and had even 
done some multithreading OOP dabbling privately, this guy really opened 
my eyes.

"Several threads may run the code of one object instance, simultaneously."

"One object instance may run several threads, simultaneously."

"Both of these may be true at any one time."

No woman has ever made me as breathless. It took me weeks to fully grasp 
  the essence of it.



More information about the Digitalmars-d mailing list