On Unix systems, memory related activity occurs when real memory is exhaustedand the kernel must utilize virtual memory. vmstat reports a variety of virtual memory statistics. The command syntax is as follows:
vmstat [ -{options} [ disks ] [ interval [ count ] ]
The interval and count arguments may be used to specify time intervals in seconds and the number of intervals to report. This allow interactive monitoring of the memory workload.
The output from the Solaris vmstat command without options is:
procs memory page disk faults cpu r b w swap free re mf pi po fr de sr f0 s1 s2 s3 in sy cs us sy id 0 0 0 15020 4304 9 58 198 228 220 0 3 0 16 1 1 86 1173 46 24 30 46
procs reports on process states. r is the number of processes in the run queue. b is the number of processes blocked and waiting for resources such as disk or terminal input. w is the number of runnable processes, or processes swapped but in a sleep state of less than twenty seconds.
Under the memory heading statistics are given on the usage of real and virtual memory. swap reports the available swap space in Kilobytes. free gives the size of the free list.
Under the page heading, page faults and page activity is reported in units per second. Page faulting occurs when the system attempts to access an unmapped page. Statistics are reported as follows:
disk lists the number of disk operations per second and can show data for up to four disks at a time. Which disks to report can be passed to the vmstat command.
faults reports the trap or interrupt rate per second. in is the number if device interrupts per second. sy is the number of system calls and cs is the CPU context switch rate.
The last group of statistics pertain to CPU usage. The amount of time spent in user mode, kernel mode and idle are reported.
vmstat can also report on swapping and cache flushing. The -S adds two fields to the beginning of the paging statistics. These are si, which lists the number of pages swapped in per second, and so, which gives the number of entire processes swapped out.
vmstat -c displays cache flushing statistics for a virtual cache. The number of cache flushes since the last reboot are listed. The output of this command looks like:
flush statistics: (totals) usr ctx rgn seg pag par 0 0 0 0 0 0The cache types listed are:
vmstat -i displays the number of interrupts per device. The output looks like:
interrupt total rate -------------------------------- clock 98080370 100 fdc0 14 0 -------------------------------- Total 98080384 100
Terms used: virtual memory, cache, kernel.