Skip to main content

Virtual Memory

In Turkish
Sanal Bellek
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/virtual-memory

In short

Virtual memory is an operating system technique that gives each process its own private address space and maps it to physical RAM or disk behind the scenes.

What is virtual memory?

Virtual memory is a way for the operating system to give every process the illusion that it has a large, private, continuous block of memory all to itself. The addresses a program uses are virtual addresses, and the operating system, with help from the CPU, translates them into real locations in physical RAM.

Memory is divided into fixed-size chunks called pages, commonly 4 KB each. A page table for each process records where every virtual page actually lives, and a hardware unit called the memory management unit (MMU) performs the translation on every memory access. If a page is not currently in RAM, the CPU raises a page fault and the kernel loads it, possibly moving a less-used page out to disk in an area called swap space or the page file.

Think of virtual memory like apartment numbers in a building run by a concierge. Each tenant only knows their own apartment numbers, while the concierge keeps a private map of which rooms actually hold their belongings, including some boxes in off-site storage. This design isolates processes from each other, lets programs use more memory than physically exists, and allows shared code such as system libraries to be loaded once and used by many processes.

Virtual memory is often confused with a virtual machine or with swap space. A virtual machine emulates an entire computer, while virtual memory is an addressing scheme inside one operating system. Swap is only one part of virtual memory, and relying on it heavily, known as thrashing, makes a system very slow because disks are far slower than RAM.

Key takeaways

  • Each process gets its own private virtual address space.
  • The MMU and page tables translate virtual addresses into physical addresses.
  • Memory is managed in fixed-size pages, commonly 4 KB.
  • Accessing a page that is not in RAM triggers a page fault, and the kernel loads it.
  • Virtual memory provides isolation, memory sharing, and the ability to exceed physical RAM.

Example

Checking memory and page size on Linuxbash
# Show physical RAM and swap usage
free -h

# Compare this shell's virtual size (VmSize) with the RAM it really uses (VmRSS)
grep -E 'VmSize|VmRSS' /proc/$$/status

# Show the page size in bytes (often 4096)
getconf PAGESIZE

Readers ask

Is virtual memory the same as swap?

No. Virtual memory is the whole system of mapping virtual addresses to physical memory, while swap is disk space the operating system can use to hold pages that do not fit in RAM. A system still uses virtual memory even with swap turned off.

What is a page fault?

A page fault happens when a program accesses a virtual page that is not currently mapped to physical RAM. The kernel handles it by loading the page, or, if the address is invalid, by stopping the program with a segmentation fault.

Does virtual memory make my computer faster?

Virtual memory mainly improves safety and flexibility rather than raw speed. It lets more programs run at once, but if the system relies heavily on swap, performance drops sharply.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings