What Is Virtual Memory on Linux? How to Manage It
Virtual memory is a way of representing your memory that's abstracted from the physical memory on your machine. It makes use of both your RAM and your storage space, whether that's on a traditional hard drive or an SSD.
In Linux, this is done at the kernel and hardware levels. The CPU has a piece of hardware called a Memory Management Unit (MMU) that translates physical memory addresses into virtual ones. These addresses are independent of where they physically reside on the machine. These address spaces are known as "pages" and they could be in RAM or on your hard drive or SSD. The OS sees these addresses as one big pool of memory, known as an "address space."
Virtual memory takes advantage of the fact that not all of the memory that's being used in theory is being used all of the time. Programs in memory are broken down into pages and the parts that the kernel deems as unnecessary are "swapped out," or moved to the hard drive. When they're needed, they can be "swapped in," or brought back into RAM.
The space used for virtual memory on a drive is known as "backing store," or "swap space." In the Windows world, it's usually implemented as a file, known as a "swap file." It's also possible to do this in Linux, but it's much more common to use a dedicated disk partition.