Re: Java Memory question
On 03/23/2011 09:46 AM, Patricia Shanahan wrote:
On 3/23/2011 6:18 AM, Lew wrote:
blmblm@myrealbox.com wrote:
Lew wrote:
From the point of view of the application (JVM in this case) the
presence of
virtual memory is transparent - it all just looks like RAM and the
application
doesn't mess with where it is. By the time the application does
access the
memory, it's been swapped into physical RAM, so the application is
dealing
only with physical RAM.
But (to my way of thinking) somewhat indirectly, since the addresses
presented by the JVM to the hardware are virtual, no?
No. The addresses presented to the OS by the JVM are just addresses;
only the OS figures out if they're currently loaded from virtual memory
or still need to be.
The addresses presented to the OS, or for that matter to the hardware,
by the JVM are not addresses of actual bytes of memory. When a page is
swapped out and in again, it usually ends up at a different place in
memory. The address the application uses to refer to it does not change.
Even if the data is already in memory, the address the application uses
has to go through a translation step to get to the bits that select a
memory module (in a system large enough to have multiple memory modules)
and drive the memory module address lines.
I would call that process "virtual to physical address translation". If
you are going to use the term "physical" for the input, what term are
you do you suggest for the addresses that select a memory module and a
location within a memory module, and for the process of translating from
an address that makes sense to an application to an address that makes
sense to the physical memory.
This is going so far away from my original point that the message is lost.
The JVM doesn't care about any of that. It sends an address to the OS and
gets something back. It lets the OS handle it. While everything you say is
true, it's completely irrelevant to the point under discussion.
My original statement is that memory to the JVM is "physical enough". The
question of address translation and all that mechanism doesn't figure into it.
When the JVM accesses memory, it accesses physical memory. That's all I
said. I made no claims about addresses or how they map. None. Zip. Nada.
All I said was that the RAM access is via physical RAM, ultimately. Is that
not true?
Even your explanation acknowledges that: "... an address that makes sense to
physical memory."
Or, as I said hoping to ignore all those extraneous and non-impactful messy
details just as the JVM itself does, "physical enough".
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg