"If you've used Linux long enough, chances are you've bumped into the term . You probably have heard people say things like "Enable swap if your system is crashing" or "Swap makes your machine slow" or "Enable swap if app is dying with OOM" So in this article, let's talk about swap memory, what it is, how to enable it, how to check if it's running, how it's different from virtual memory, and when it helps vs. when it hurts."
"Swap is simply a portion of your disk (HDD/SSD/NVMe) used as a slower backup for RAM. When your RAM fills up, the Linux kernel quietly moves "cold" data( i.e. rarely used memory pages) into swap, freeing up RAM for things we are actively running. Swap doesn't replace RAM. It extends it. RAM = fast working space Swap = slower storage space for unused or idle data"
Swap uses a portion of disk (HDD/SSD/NVMe) as a slower backup for RAM. When RAM becomes full, the kernel moves cold or rarely used memory pages into swap to free RAM for active processes. Swap extends usable memory capacity but cannot match RAM performance and does not replace it. Swap can prevent crashes or OOM kills by providing additional backing storage, but heavy swapping degrades performance because disk access is much slower than RAM. Swap and virtual memory are distinct concepts. Enabling, checking, and tuning swap depends on workload requirements and latency tolerance.
Read at Medium
Unable to calculate read time
Collection
[
|
...
]