SUMMARY: paging vs. swapping

From: Kes Masalaitis (kes@mtb.phil.mop.com)
Date: Mon Mar 18 1996 - 09:15:18 CST


Thanks to all who responded. Individual replies are below.

The one paragraph summary: Paging refers to paging out individual
pages of memory. Swapping is when an entire process is swapped out.
Paging is normal. Swapping happens when the resource load is heavy
and the entire proces is written out to disk. If you're swapping
a lot, you might want to look deeper into looking at things like
adding memory.

Kes

From: esilva@netcom.com (Eduardo E. Silva)
  
Both will degrade performance on ANY UNIX box. Paging is done when a process
starts up, or when its data segment grows. If the process needing extra RAM,
can't get it from the dirty list, it will cause a major page fault. Swapping
occurs when the amount of RAM is not enough to store most or all of the
active procesesses. Both require disk access which is not big deal, until
the number of precess swapping and paging grows up.

From: ajs6143@eerpf001.ca.boeing.com ( Andy J. Stefancik 237-2164 )

Paging is how all processes normally run. A pafe fault occurs, which is
normal operation, and a new page of a program is paged in, and freed pages
are paged out. this is not swapping. This allows each program to have
4 gigs of virtual memory, even though there may only be 32 meg of physical
memory. Swapping is at the process level. This will only occur if the
resource load is heavy and and system performance is degrading. The lowest
priority process is written out to swap space. This could be a sleeping
process, which are the highest candidates for swap out. When they become
active again, a new candidate is swapped out, if need be, and the process
is swapped in.
        The only difference in the virtual filesystem between SunOS an
        Solaris is that on Solaris 2.5, freed pages are now NOT written to
        swap, they are just deleted, as it was found that a very low percentage
        of freed pages were ever used again. This makes paging a little
        more efficient and consumes less swap space.
        
Hope this helps. If you need more information a Solaris Internals Class
would be helpful.

Andy S.

From: nleroy@norland.idcnet.com (Nicholas R LeRoy)

Well...

Paging refers to paging out individual pages of memory. Swapping is
when an entire process is swapped out.

Some information on how parts of it works:

Unix executables are essentially
stored as separate pages, each occupying a separate 'page' of memory.
As an executable is first run, the OS loads in its first page and
begins executing it. When that page references a different page,
that page is then loaded, or 'paged' into memory. That page can then
reference other pages which are then paged in. These are called
'demand paged executables'.

As these pages are (or should never be) modified, they never get swapped.
When the OS determines that memory needs to be freed up, and it finds
an executablepage which it decides to release to free up memory, that
page can be simply marked as free -- if it is needed again, it can
always be paged in from disk. That's why you can't write to an
executable file which it's being executed -- because the OS relies
on those pages being available when needed.

Data area are paged out to the swap area(s). These
can then be re-loaded into memory when required.

Hope this helps. Let me know if I can clarify anything.

Check out "Modern Operating Systems" by Andrew Tanenbaum.

From: peter.allan@aeat.co.uk (Peter Allan)

This is covered in the current issue of UNIX REVIEW magazine.

Swapping takes an entire program out of real memory, while paging
only takes out parts of it.

UR is worth reading, provided you can ignore dozens of adverts
for GUI builders.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:55 CDT