When a computer needs to access data from main memory that information needs to be present in main memory. This is not a problem when there is unused memory.
However if the memory is (mostly) full then the OS has a few choices:
- Abort with an out of memory message.
- Swap out some process (All of it).
- Page out single memory pages. These are likely part of an active program but can be reloaded when they are next accessed (either from the volume it was paged out to, or if unchanged, reloaded from disk).
This last process is called paging.