How Paging Saves External Fragmentation?
Please answer this question as soon as possible. i concern many books but still confused. Please elaborate this topic.
- FlagMichaelLv 73 years ago
Paging is a matter of holding data in memory. Fragmentation is the result of writing data to storage, so the more the computer can rely on the paging file for writing new data the less fragmented the resulting file will be when written to disk.
A typical fragmentation problem occurs when a document is being revised. If the original document is 100K and is followed immediately on the disk by another file, any additions to the document will make it longer and that addition has to go someplace else as a fragment. If there are two documents open at the same time (like one for how to clean up the house and a second one for where to find the things that have been put away) and they are each being edited alternately, without paging there could be dozens of tiny fragments in each one as they were written. With paging each file gets written once instead of dozens of times..
When you pack the car for a vacation trip, you gather up all the various items according to when they will be used. All the beach things will go in first so they will come out last, suitcases will go on top. If you just threw the stuff in the trunk it would all be jumbled. The original piles of items are like paging and the mix (or not) of the items in the trunk is like fragmentation.
- 3 years ago
In the memory management techniques discussed so far, two Paging is a memory
management scheme that permits the physical address space of a process to be noncontiguous.
It avoids the considerable problem of fitting the various sized memory
chunks onto the backing store, from which most of the previous memory-management
schemes suffered. When some code fragments or data residing in main memory need to
be swapped out, space must be found on the backing store. The fragmentation problems
discussed in connection with main memory are also prevalent with backing store, except
that access is much slower so compaction is impossible.
Physical memory is broken down into fixed-sized blocks, called frames, and logical
memory is divided into blocks of the same size, called pages. The size of a page is a
power of 2, the typical page table size lying between 1K and 16K. It is important to keep
track of all free frames. In order to run a program of size n pages, we find n free frames
and load program pages into these frames. In order to keep track of a program’s pages in
the main memory a page table is used.
Thus when a process is to be executed, its pages are loaded into any available
memory frames from the backing store. The following snapshots show process address
space with pages (i.e., logical address space), physical address space with frames, loading
of paging into frames, and storing mapping of pages into frames in a page table.
Paging itself is a form of dynamic relocation. When we use a paging scheme, we have
no external fragmentation; however we may have internal fragmentation. An important
aspect of paging is the clear separation between the user’s view of memory and the actual
physical memory. The user views that memory as one single contiguous space,
containing only this program. In fact, the user program is scattered throughout the
physical memory, which also holds other programs.
• Page size = 4 bytes
• Process address space = 4 pages
• Physical address space = 8 frames
• Logical address: (1,3) = 0111
• Physical address: (6,3) = 1011