3

When I launch php-script and do ps aux and have huge number for VSZ, about 450MB. Whilst RSS -- Resident set size -- is about 10MB. From wikipedia, Resident set size is is the portion of a process's memory that is held in RAM. But does Virtual memory size include memory held somewhere else, say in filesystem? What exactly does Virtual memory consist of?

4

Virtual memory (as the name implies) is an abstraction over the underlying physical memory architecture. Each process gets its own virtual address space, and when virtual adresses are accesses, they are first converted to hardware addresses by the Memory Management Unit(MMU). Data in the virtual address space of a process may be either in main memory, on disk, both or some other external memory. However, every page that is not allready in main memory (MM) is loaded into MM when they are accessed by a process. Thus, processes do not read directly from disk, but some or most of their resources may reside on external memory at any given time, as pages can be swapped out to make place for others.

5

Virtual memory might be:

  • on RAM if the data has been accessed recently or if there is no pressure to release RAM
  • on the swap area (swap partition or swap file) if it has been paginated out
  • on the file system if the data correspond to memory mapped files (eg: shared libraries)
  • nowhere (i.e. use no resource, especially on systems over-committing memory like Linux) if allocated pages have not been accessed yet

The fourth point is often overlooked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.