Page ins and page outs - could somebody please explain this to me in idiot fashion?

ian27

It all started at 3......
Hi guys,

I have been having some sluggish performance recently and I'm guessing it could be something to do with memory allocation. I have been reading a few things on this board and have found that page ins/outs can have an effect on performance (although I'm still not entirely sure what it all means).

I have closed all my applications except for my browser and the activity viewer to see what is going on. My page readings on the system memory page state:

Page ins/outs 182139/247702.

I have read somewhere that if you have more page outs than ins then you have a problem. Therefore my questions are:

a. Is this actually true and what do page in/outs actually mean?
b. Will adding more RAM to my machine help? I currently own an eMac 1.25ghz with 512 RAM, running OS 10.3.5.
c. What other tips might help its performance?
d. What is the difference between inactive memory and free memory?

In addition, my applications also seem to use up a lot of VM. Could this also cause performance problems?

Thanks in advance for your time.

Ian
 
OK, to summarise what it means, your computer has a certain amount of RAM, which is its "memory". It simulates more RAM by allowing extra data to be saved to the hard disk, which is known as Virtual Memory.
To do this, it breaks your memory space up into "pages". Applications that need access to data that is in memory call the data by page. If an application calls a page and it is in the RAM, then it is a "page in" occurs. If an app calls for a page from memory, and that page is currently stored on the hard disk and has to be read back into the RAM, then a "Page Out" occurs.
A "Page-out" slows the operation of the system down because it has to read the data from a hard disk into RAM first, rather than reading straight from the RAM. Hard disks take about 300 times as long to transfer a page of data, which adds up to slow performance.

If page-outs exceed page-ins, you definitely don't have enough RAM. Ideally, page-outs should be less than 20% of the number of page-ins (the fewer page-outs, the faster your machine is performing) On my machine, I aim for less than 5%.

Adding more RAM, or reducing the number of open applications, are the only ways to reduce page-outs. While freeing up memory by working with fewer and smaller files and apps may help, more RAM is the only reasaonable solution.
 
  • Like
Reactions: lbj
You have a limited amount of RAM in your machine. Each process thinks it owns the entire machine, it has all the processor avalible, and it has infinite RAM. In order to do this, the OS has a swap system. When something is put into RAM, it is placed into a 'page' in RAM. When a page is not being used, then it is 'paged' out, and put into swap, which is on the hard drive.

As you can imagine, using swap is a great idea, but your hard drive is slow as compared to RAM, so if you have more RAM, you do not have to swap as much.

As for the number of page ins/outs, I dont see that as a problem. It just means that more stuff is being pulled out, than was being put in.

The question you want to ask is, over what time period did this occur? On my machine:

[bob@Freebird] ~%uptime
18:59 up 1 day, 5:36, 4 users, load averages: 0.18 0.14 0.14

86047 in
37538 out

This is normal to me.
 
Hi guys, thanks for your prompt replies.

From what you say I'm guessing this may also answer this question. Sometimes I'll check the available space on my internal hard drive and it will have say, 10GB available. Then when I restart the machine is suddenly has say 11GB available. I'm presuming this must be because it has emptied the VM or something like that anyway?

Also, rbb, you asked what time period the page outs occurred over. How can I check this?

Thanks again fellas - your help is very much appreciated.

Ian
 
The command uptime.

The extra space, I am going to say is from clearing out /tmp
All my machines are setup to delete the contents of /tmp upon reboot.
 
I recently read a supposedly authoritative source that said there is a very big difference in Panther performance between a machine with 512 MB RAM and 640 MB. That source recommended 640 MB as the "sweet spot" although performance continues to improve all the way up to 1 GB and more. I cannot verify that scientifically, but from my experience I would be inclined to believe that is true.

Perhaps this will help you understand OS X memory usage a little better:
  • all memory in OS X is "virtual". Some of that virtual memory is in RAM, some in system and application files on the hard drive, and some may be in swapfiles
  • Wired RAM is memory that is pernamently "locked" by the OS and cannot be made inactive or moved to swapfiles. It must be there for the operation of the OS
  • Active RAM is memory that is currently in use by either the system or an application.
  • Inactive RAM may be thought of as a first stage swapfile. It contains instructions and data that are not currently in use within the OS or an application, but is left in RAM in the event it is needed again. If more Active RAM is needed, the Inactive RAM will be reassigned and if it contains data for a currently open application, that data will be rolled out to a swapfile. Otherwise the memory will simply be overwritten.
  • Free RAM is just that. It is RAM that is currently not mapped into Wired, Active, or Inactive RAM. If more Active RAM is needed, the Free RAM will be the first to be remapped into Active status.
  • Swapfiles are used to contain data being used by currently open applications for which there is currently no room in either Active or Inactive RAM
  • System resources, fonts, application files, frameworks (shared libraries) are mapped into the virtual memory address space for each application whether they are in Wired, RAM Active RAM, Inactive, RAM, or in files on the HD, but these resources are never placed in the swapfile(s) because they are already available on the hard drive and there is no point in duplicating the code.
  • Pageins occur anytime something is moved into Active RAM whether that is from Inactive RAM, the swapfile(s), or another file on the hard drive.
  • Pagouts occur anytime anything is moved out of Active RAM which includes mapping into Inactive RAM, as well as writing to a Swapfile. Only data is ever written to the hard drive since instructions are already on the hard drive.
All in all this is a very efficient use of memory. It also has the benefit of providing an almost invulnerable wall protecting the operating system and each application from inadvertent intrusion by ill behaving code. This is one of the "secrets" of OS X stability.
 
Thanks perfessor101, the information that you have given is extremely helpful and certainly answers a lot of my questions.

Well it looks like some more RAM will certainly benefit me. It's lucky that I've just been paid for my last project :)

Thanks again for all your help.

Ian
 
Hay all,

can someone explain exactly what this means

12:06 up 3:18, 2 users, load averages: 0.24 0.38 0.40

I know : this is the actual up time - 12:06 up 3:18

But what do these represent? load averages: 0.24 0.38 0.40
 
Load average is related to the number of processes running and waiting to run.

The load averages differ from CPU percentage in two significant ways:

1) load averages measure the trend in CPU utilization, not only an instantaneous snapshot (as does ...percentage), and

2) load averages include all demand for the CPU not only how much was active at the time of ....measurement.​

AFAIK, the three sets of number outputs are the 1-minute, 5-minute and 15-minute average
 
ok, but whats the explaination of the numbers? is 0.25 - 25% usage and how is this broken down in the 3 groups of numbers? How high do these numbers go?

e.g. 0.24 0.38 0.40, there are 3 clear groups/sections

1=0.24
2=0.34
3=0.40

they must all mean/cover something different, so what are they

thanks,
 
Load averages tell how many processes are there waiting for their turn. The values are for one minute, five minute and fifteen minute averages.
So if the values are

Code:
0.2 1.2 12.4

and you have one processor, during last minute there has been 0.2 processes running, i.e 80% of the time the processor has being idle. During the last five minute there has being 1.2 processes running, but since there is only one processor, the 20% of them were waiting for their turn. During the last fifteen minutes there has being 12.4 processes running, i.e for each running process there have being 11.4 waiting. If you have several processors or multi-core processor, load under 1 is common.

If you run command top, you see what the running programs (i.e. processes) are and how much they use processor, time and memory.
 
Back
Top