(Lee) wrote:
> I have searched all java groups and I can not get understanding on
> working memory on a JVM. What is _working memory_ after all? The
> concept is only briefly discussed in Chapter 8: Threads and Locks.
> But I have not found much useful info in 3.5 Runtime Data Area. I
> have browsed some open source JVM implementation, still can not find
> how the working memory works?
Per the Java2 Language Specification, section 17.1 (Terminology and
Framework):
"Variables are kept in a *main memory* that is shared by all
threads..."
"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..."
Essentially, "working memory" means any memory that a thread is using
which is NOT guaranteed to be fully and synchronously shared with
other threads.
In practice, this would include L1 and L2 hardware caches, CPU
registers, CPU stack data, Java stack data, and any other temporary
storage being used by a thread.
When running in a multi-CPU system, this stuff is REALLY important.