The kernel problem with recent updates has been solved. Find the solution here

Important information
-- Required MX 15/16 Repository Changes
-- Information on torrent hosting changes
-- Information on MX15/16 GPG Keys
-- Spectre and Meltdown vulnerabilities

-- Introducing our new Website
-- MX Linux on social media: here

Current releases
-- MX-18.3 Point Release release info here
-- Migration Information to MX-18 here
-- antiX-17.4.1 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

How swap space is used in Linux and Unix

Post Reply
User avatar
Posts: 3353
Joined: Sat Aug 22, 2009 11:36 pm

How swap space is used in Linux and Unix


Post by BitJam » Tue Aug 13, 2019 2:47 pm

I learned a lot from this article: What has to happen with Unix virtual memory when you have no swap space

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.
Will I cry when it's all over?
When I die will I see Heaven?

User avatar
Posts: 10151
Joined: Wed Jul 12, 2006 1:42 am

Re: How swap space is used in Linux and Unix


Post by Adrian » Tue Aug 13, 2019 3:55 pm

Oh, interesting didn't know about no. 3.

User avatar
Forum Regular
Forum Regular
Posts: 1871
Joined: Sat Jun 30, 2018 6:33 pm

Re: How swap space is used in Linux and Unix


Post by manyroads » Tue Aug 13, 2019 6:22 pm

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. :needcoffee:
Pax vobiscum,
Mark Rabideau - http://many-roads.com
bspwm MX-18.3 kernel: 5.1.11-antix.1-amd64-smp
"For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken
Testing: antiX19

User avatar
Forum Regular
Forum Regular
Posts: 205
Joined: Fri Sep 21, 2018 9:09 am

Re: How swap space is used in Linux and Unix


Post by mxer » Wed Aug 14, 2019 4:56 am

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. :happy:
(FOSS, Linux, & BSD since 1999)

User avatar
Posts: 2843
Joined: Fri Dec 12, 2008 10:31 am

Re: How swap space is used in Linux and Unix


Post by Richard » Wed Aug 14, 2019 6:15 am

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.
LT: MX18.3: Thinkpad T430: DualCore, Intel i5-3320M, Ivy Bridge; 8GB RAM; 4.19.0-5-amd64; 119GB SSD 840PRO, Intel Graphics-Audio-Network

NB: antiX19b2full-xfce; MX18.3: AsusTek EeePC 1005HA: Intel DualCore Atom N270, 1GB RAM, 4.19.0-5-686, 150GB HDD

Post Reply

Return to “General”