I learned a lot from this article: What has to happen with Unix virtual memory when you have no swap space
TL;DR:
1) Running out of memory with no swap will bring your system to its knees (or worse).
2) Swap is only used for memory that does not already have a copy on disk. Libraries and executables are usually available on disk and therefore don't use swap space.
3) Therefore if you are running out of memory and have no swap then the disk will still thrash as it swaps out libraries and executables that may be needed right away.
How swap space is used in Linux and Unix
How swap space is used in Linux and Unix
"The first principle is that you must not fool yourself -- and you are the easiest person to fool."
-- Richard Feynman
-- Richard Feynman
Re: How swap space is used in Linux and Unix
Oh, interesting didn't know about no. 3.
Re: How swap space is used in Linux and Unix
I have found that my swap is almost 100% idle. Could be because I have 24GB of RAM.... Anyway on all my new builds I just add RAM and ignore swap. Sloppy programmer behavior I guess.
Pax vobiscum,
Mark Rabideau - ManyRoads Genealogy -or- eirenicon llc. (geeky stuff)
i3wm, bspwm, hlwm, dwm, spectrwm ~ Linux #449130
"For every complex problem there is an answer that is clear, simple, and wrong." -- H. L. Mencken
Mark Rabideau - ManyRoads Genealogy -or- eirenicon llc. (geeky stuff)
i3wm, bspwm, hlwm, dwm, spectrwm ~ Linux #449130
"For every complex problem there is an answer that is clear, simple, and wrong." -- H. L. Mencken
Re: How swap space is used in Linux and Unix
As long as you have enough ram to cover your computer use needs, you don't need any swap, but if you do work that requires a lot of ram use, compiling big programs/intensive video work, etc, then you'd better have some. probably the equal of the amount of ram you have installed.
Me? I used to get away with no swap on a 1GB machine, but now have at least 2GB, because of how much a modern web browser wants to use.
Me? I used to get away with no swap on a 1GB machine, but now have at least 2GB, because of how much a modern web browser wants to use.
(FOSS, Linux, & BSD since 1999)
Re: How swap space is used in Linux and Unix
I use a 1 GB swap file on /media/SWAPFS of the T430, just in case. And I occasionally see a small usage.
Probably for my use even ½ GB would suffice.
I believe it has reduced some occasional lags that I noticed while running without any swap.
All subjective but it feels right.
Probably for my use even ½ GB would suffice.
I believe it has reduced some occasional lags that I noticed while running without any swap.
All subjective but it feels right.
Thinkpad T430 & Dell Latitude E7450, both with MX-21.3.1
kernal 5.10.0-26-amd64 x86_64; Xfce-4.18.0; 8 GB RAM
Intel Core i5-3380M, Graphics, Audio, Video; & SSDs.
kernal 5.10.0-26-amd64 x86_64; Xfce-4.18.0; 8 GB RAM
Intel Core i5-3380M, Graphics, Audio, Video; & SSDs.