An operating system (OS) is a computer program that
manages the hardware and software resources of a computer. At
the foundation of all system software, the OS performs basic tasks
such as controlling and allocating memory, prioritizing system
requests, controlling input and output devices, facilitating networking,
and managing files. It also may provide a graphical user interface
for higher level functions. It forms a platform for other software.
Another important part of memory management is managing
virtual addresses. If multiple processes are in memory at once,
they must be prevented from interfering with each other's memory
(unless there is an explicit request to share a limited amount
of memory, in controlled ways). This is achieved by having separate
address spaces. Each process sees the whole virtual address space,
typically from address 0 up to the maximum size of virtual memory,
as uniquely assigned to it. The operating system maintains tables,
so-called page tables, that match virtual addresses to physical
addresses.
The operating system can also write inactive memory
pages to secondary storage. This process is called "paging".
The operating system tracks all memory used by each
process so that when a process terminates, all memory used by
that process can be made available for other processes.