Virtual Memory

Domain: Computer Systems

🎯 Motivation

When RAM is full, the OS uses disk space as ‘virtual memory’. Much slower than RAM but prevents crashes.

📋 Concrete Example

8GB RAM full. OS moves inactive data to disk (swap space). RAM has space for active data. When the inactive data is needed again, it is moved back. Slow but prevents out-of-memory crashes.

🔗 Analogy

Virtual memory is like using a backpack when your desk is full - you put less-used books in the backpack (disk swap) and keep current books on the desk (RAM). When you need a backpack book, you swap it with a desk book. Slower, but you can work with more books than the desk can hold.