Friday , 28 October 2016
Breaking News
Home » WWW » The top utility simply displays the current number of pageins

The top utility simply displays the current number of pageins

A pageout occurs when memory is written to the backing store. Unlike older methods, Mac OS X pages rather than swaps. In earlier systems, a program was either fully in main memory or was swapped out entirely. Mac OS X, on the other hand, can take pages 4k blocks of RAM and get them out of the way, or pull them back in as needed.

A pager is responsible for moving pages in and out of RAM. A page-fault occurs when the system looks for something that should be in core memory but doesn’t find it. A page-fault then causes the pager to read the appropriate page or pages from the backing store and into core memory. What does top have to say about all of this?
The top utility simply displays the current number of pageins and pageouts requested by a pager. These counts are shown as the total number, followed by the recent counts in parentheses. The recent counts are the number of pageins or pageouts in the last 1 second for the respective counter. These are important values to watch. Normally, these are 0 especially for pageouts. If you’re watching top, and the number of recent pageouts stays above 0, your system is short on real RAM. The count of pageouts will rise occasionally. However, if you’re witnessing a surge of pageouts over a long period of time, your system is thrashing the system spends more time paging in and out than actually accomplishing any real work. If you see your pageouts keep creeping up, the course for system improvement is to increase the RAM in your machine.

To get more specific and detailed information about VM statistics, use the vm_stat command. This simple tool gives grand-total and interval-based statistics regarding the VM system, such as free and wired pages and pagein and pageout totals. See the man page for further information on the vm_stat command.

This sample is sorted by %CPU, issued with top -u. This makes the process area of top dynamic, always sorting the highest CPU-using tasks to the top. The columns are described as follows:

– PID The BSD process ID

– Command The name of the program or application bundle

– %CPU The percentage of CPU cycles used during top’s refresh interval for this process, including both kernel and user space

– Time CPU time used by this process since launch, in minutes:seconds:hundredths format

– #TH Number of threads in use by this process

– #PRTS Number of machine ports used by the process

– #MREGS The number of memory regions this process has allocated

– RPRVT The amount of resident private memory probably the best of these statistics to determine how much real memory a program is using

– RSHRD The amount of resident shared memory used

– RSIZE Resident memory size

– VSIZE The total address space allocated to the program

There are other switches to top that will alter the number of columns and amount of information displayed. See the top man page (type man top) for more information. The -l switch turns on logging mode, which makes top noninteractive it just dumps its output raw to stdout. You can tell top how many times it should output. A value of 0 causes top to loop until you interrupt it by pressing Control-C. For example, top -l 0 -u -n 15 is useful to find issues when waking from sleep (too much happens before you can open a terminal and run anything to record the activity): Run top with the -l switch before putting a machine to sleep. This way, there will be a record of what happens on wake.

About Emma G.

Working in the marketing industry since 2002. This blog is one of my hobbies.

Leave a Reply