The memory management subsystem is one of the most important parts of the operating system. Since the early days of computing, there has been a need for more memory than exists physically in a system. Strategies have been developed to overcome this limitation and the most successful of these is virtual memory. Virtual memory makes the system appear to have more memory than is physically present by sharing it among competing processes as they need it.
Virtual memory does more than just make your computer’s memory go farther. The memory management subsystem provides:
- Large Address Spaces
- The operating system makes the system appear
as if it has a larger amount of memory than it actually has.
The virtual memory can be many times larger than the physical memory
in the system.
- Each process in the system has its own virtual address
space. These virtual address spaces are completely separate
from each other and so a process running one application cannot
affect another. Also, the hardware virtual memory mechanisms allow
areas of memory to be protected against writing. This protects
code and data from being overwritten by rogue applications.
- Memory Mapping
- Memory mapping is used to map image and data files into a
process’ address space.
In memory mapping, the contents of a file are linked
directly into the virtual address space of a process.
- Fair Physical Memory Allocation
- The memory management subsystem
allows each running process in the system a fair share
of the physical memory of the system.
- Shared Virtual Memory
- Although virtual memory allows processes
to have separate (virtual) address spaces, there are times
when you need processes to share memory.
For example there could be several processes in the system
running the bash command shell.
Rather than have several copies of bash, one in each
process’s virtual address space, it is better to have only one copy in
physical memory and all of the processes running bash
Dynamic libraries are another common example of executing code
shared between several processes.
Shared memory can also be used as an Inter Process Communication (IPC) mechanism, with two or more processes exchanging information via memory common to all of them. Linux supports the Unix System V shared memory IPC.