2. Exercises

See the book for exercises using mem.c and vmstat
$ /sbin/swapon -s
Filename                                Type            Size    Used    Priority
/dev/md1                                partition       7806972 827184  -2

$ cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/md1                                partition       7806972 827184  -2

$ top
top - 12:11:30 up 10 days,  4:36,  6 users,  load average: 0.09, 0.42, 0.42
Tasks: 286 total,   1 running, 220 sleeping,   4 stopped,   0 zombie
%Cpu(s):  1.4 us,  1.1 sy,  0.0 ni, 97.4 id,  0.1 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem : 16188300 total,  2665948 free,  1447960 used, 12074392 buff/cache
KiB Swap:  7806972 total,  6979788 free,   827184 used. 14136572 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
11226 perry     20   0   44216   3936   3264 R  12.5  0.0   0:00.03 top
 2488 perry     20   0 3944640 334564  74652 S   6.2  2.1 275:49.35 gnome-shell
    1 root      20   0  225676   6100   3968 S   0.0  0.0   2:11.45 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.33 kthreadd
...