Swap space

Thrashing: Its causes and prevention by Peter Denning is a primary reference that describes how virtual memory mismanagement can bring a time-sharing CPU to a halt.

See  Paging: Introduction for a basic understanding of how an operating system pages virtual memory and Brian Boucheron's practical tutorial on swapon.

See Evan Anderson's tour of top, free and vmstat on StackExchange.

Output of free:

$ free
             total       used       free     shared    buffers     cached
Mem:        775556     759456      16100          0      22132     592484
-/+ buffers/cache:     144840     630716
Swap:       500344      21972     478372

Output of vmstat:

$> vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 433664 572472 187800 2417100    0    2    13    60   42   30 12  4 84  0  0
 
FIELD DESCRIPTION FOR VM MODE
   Procs
       r: The number of runnable processes (running or waiting for run time).
       b: The number of processes in uninterruptible sleep.

   Memory
       These are affected by the --unit option.
       swpd: the amount of virtual memory used.
       free: the amount of idle memory.
       buff: the amount of memory used as buffers.
       cache: the amount of memory used as cache.
       inact: the amount of inactive memory.  (-a option)
       active: the amount of active memory.  (-a option)

   Swap
       These are affected by the --unit option.
       si: Amount of memory swapped in from disk (/s).
       so: Amount of memory swapped to disk (/s).
user@ux305-3:~$ vmstat -s
      8042620 K total memory
      4859328 K used memory
      1397600 K active memory
      5113964 K inactive memory
       575084 K free memory
       187384 K buffer memory
      2420824 K swap cache
      2097148 K total swap
       433664 K used swap
      1663484 K free swap

Output of sar

Collect, report, or save system activity information:

user@ux305-3:~$ sar -h -S 1 3
Linux 5.15.0-41-generic (ux305-3) 	07/xx/20xx 	_x86_64_	(4 CPU)

02:29:53 AM kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
02:29:54 AM      1.6G    423.5M     20.7%     14.4M      3.4%
02:29:55 AM      1.6G    423.5M     20.7%     14.4M      3.4%
02:29:56 AM      1.6G    423.5M     20.7%     14.4M      3.4%
Average:         1.6G    423.5M     20.7%     14.4M      3.4%
user@ux305-3:~$ 

Written by:

Mike Ricos

Mike Ricos

distributed systems
Building biological data networks.