On Jan 12, 2004, at 10:03 AM, Gordon Henriksen wrote:

On Monday, January 12, 2004, at 04:29 , Jeff Clites wrote:

5) Java seems to use a check-in/check-out model for access to global data, in which global data "lives" in a central store, but is copied back-and-forth to thread-local storage for modification. I don't fully understand the performance benefit which I assume this provides, but this is something else we need to understand. It's discussed in detail in the threads section of the JVM spec, <http://java.sun.com/docs/books/vmspec/2nd-edition/html/ Threads.doc.html>.

The passage in question being:


Every thread has a working memory in which it keeps its own working copy of variables that it must use or assign. As the thread executes a program, it operates on these working copies. The main memory contains the master copy of every variable. There are rules about when a thread is permitted or required to transfer the contents of its working copy of a variable into the master copy or vice versa.

There's that passage, but actually the following sections go into depth about the semantic constraints on how this is supposed to work.


This is very obliquely phrased, but it refers to the register file and stack frame. Or, since the Java bytecode is stack-based, it refers to the stack.

You might be right, but that's not exactly how I read it, because later it says, "A use action (by a thread) transfers the contents of the thread's working copy of a variable to the thread's execution engine. This action is performed whenever a thread executes a virtual machine instruction that uses the value of a variable."


I assume that the stack would correspond to the "execution engine" here, rather than to the "thread's working copy", but I could read it either way.

In any case, I thought this sounded like an interesting model, but based on the rules in that section about how accesses to data in the thread-local store have to correspond to accesses of the main store, it wasn't apparent to me how there was an advantage over just accessing things directly out of the main store. But I assume I'm overlooking some subtlety, and that there may be an idea here that we could use to our advantage.

JEff

Reply via email to