Quote:
... by what measure is none of the previously used memory accessible?
|
Here's a thirty-second primer on
virtual memory. Every process runs in an environment where it appears to have "memory" exclusive to itself. But the reality is that hardware features are used to
translate the addresses issued by the program to the (unknowable ...) actual location in physical-RAM where the information resides. If the information is
not now present in physical RAM, an interrupt is generated which causes Linux to retrieve
("swap in") the requested information and make it available ... suspending the process until this has been done, at which time the process resumes execution, "none the wiser."
The information in question may have been "swapped out" to disk since it was "not recently used." In which case the data will be read ("swapped") back in. Or it may be that the location had never been referenced before, in which case Linux will allocate a physical memory page,
set it entirely to zero, and then make it available.
Either way, the "memory" that is available to any process is always
its purely-virtual picture. Data "left over" from any other process is never available. As far as any process is concerned, "it is the only game in town."
When actual "pressure" exists for the physical-RAM resource, Linux is constantly scanning for "not recently used" memory-pages that can be "swapped out" to disk to make room. In a crisis situation that should never happen, the "OOM killer = Out-of-Memory killer" can start killing-off processes to free up room.
A virtual-machine (VM) monitor uses the same mechanisms to manage the VMs.