1838205 Members
4586 Online
110125 Solutions
New Discussion

paging and swapping

 
SOLVED
Go to solution

paging and swapping

what is the difference between paging and swapping?

thanks.
just do it!
6 REPLIES 6
John Poff
Honored Contributor
Solution

Re: paging and swapping

Hello,

Paging is the act of moving portions of active processes to disk in order to reclaim physical memory. Swapping is moving entire processes to disk to reclaim their space. In HP-UX, you have "swap" space, but in the modern versions HP is doing paging, using the swap space.

Does that help any?

JP
James R. Ferguson
Acclaimed Contributor

Re: paging and swapping

Hi Jennifer:

"Swapping" actually refers to an old(er) memory managment mechanism wherein all "pages" of a process where rolled-out to disk when memory needed to be freed. "Paging" is the modern, more sophisticated mechanism wherein pages of memory are aged over time and so moved to disk as they become unused. Paging imposes much less overhead than the all-or-none swapping.

Loosely, the terms "swapping" and "paging" are sometimes used interchangably.

...JRF...
Magdi KAMAL
Respected Contributor

Re: paging and swapping

Hi Jennifer,

Process of paging and swaping are interchangebly used.
But there is a difference between then:

1. Paging : Is the process of removing only one page from virtual space into physical memory and this is called "Page in", and removing only one page from physical memory into the virtual space and this is called "page out".

2. Swapping : Is the process of removing all of a process's pages from physical memory to virtual space and called "Swap out", and removing all of a process's pages from virtual space to physical memroy and it is called "Swap in".

Conclusion :
Paging : Only one page.
Swapping : the entire pages belonging to a process.


Magdi
Bill Hassell
Honored Contributor

Re: paging and swapping

Prior to 10.00, HP-UX did swapping. A 50 megs process (like Netscape) might be waiting for keyboard input and a copy of vi (which takes about 1 meg) needs to run. If there is no more room, all 50 megs of Netscape are swapped (many seconds will be required). When Netscape is reactivated, all 50 megs must be restored from swap.

In paging, HP-UX first deactivates processes which aren't really doing anything (ie, waiting on input) when memory gets full. Then, when a new process like vi comes along, a small portion of the deactivated process is written to swap (just a few megs) and when it's time to reactivate the big process, only the missing pages need to be returned. Hence the name: paging.


Bill Hassell, sysadmin
Victor_5
Trusted Contributor

Re: paging and swapping

Paging
When process executing, a program's pages of data and instructions are copied to and from secondary storage as needed. The kernel always tried to maintain a threshold of free pages in order to keep the system running efficiently. As long as this threshold is maintained, no paging occurs. When the number of free ages drops below this threshold, page out will occur.

Swapping
Swap space is an area on a high-speed storage device, reserved for use by the virtual memory system for paging processes. It is a method that managed physical memory resources by moving entire processes between main memory and secondary storage. However, paging is a more efficient memory resource management mechanism for virtual memory.

Re: paging and swapping

thanks guys!
just do it!