"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. Swap is one of the actual physical places Linux can store memory when RAM is full or when certain pages aren't being used actively."
Swap uses disk space as a slower backup for RAM by moving rarely used (cold) memory pages to disk so active tasks can use RAM. Swap extends available memory but is much slower than RAM, causing latency when swapped pages are accessed. Swap is a physical storage option used by the virtual memory system; virtual memory is the abstraction of address spaces while swap is one storage mechanism. Swap can prevent out-of-memory kills and support hibernation, but excessive swapping (thrashing) severely hurts performance. Enabling swap depends on workload, RAM size, storage speed, and tolerance for latency.
Read at Medium
Unable to calculate read time
Collection
[
|
...
]