> From: Oded Arbel [mailto:[EMAIL PROTECTED] > Subject: Re: Java databases as alternative to MySQL on OS X > Server? (OT) > > inter-thread communication in java is done through shared > memory - shared variables, but the Java memory sharing model > doesn't really share memory, Instead it uses thread local > storage to store copies of shared variables and when you > cross into or out of a synchronized block, the contents of > the variables are copied.
That's one of the most bizarre and blatantly wrong descriptions of the Java memory model that I've ever read. All Java objects reside in the Java heap, which is shared across all threads of the JVM process and directly referenceable by all. Local variables for a Java method exist in each thread's Java stack, which is normally not shared across threads other than for garbage collection operations. Entering a synchronized block in a HotSpot-based JVM normally does not require any context switching, since the lock on an object is established via the platform's compare-and-exchange instruction; only if a conflict exists are kernel services required to suspend the conflicting thread. (This is also true of the JRockit and IBM JVMs, as well as several others.) No copying of local variable is ever performed; on some OS implementations, parameters are copied when calling a kernel service that requires a context switch but that occurs within the OS, not the JVM. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]