Report On Pagging
Report On Pagging
Overall, paging the page tables allows the operating system to make
efficient use of memory by allocating it as needed and only keeping
necessary portions of the page table in physical memory.
3
INTRODUCTION
Most OS’s allocate a page table for each process. A pointer to the
page table is stored with the other register values in the process
control block. When the dispatcher is told to start a process, it must
reload the user registers and define the correct hardware page table
values from the stored user page table.
But the time required for accessing the user location is too large. The
solution to this problem is to use a special small fast lookup hardware
cache called translation look aside buffer (TLB). The TLB is
associative, high-speed memory. Each entry in the TLB consists of
two parts a key (or a tag) and a value.
The TLB contains only a few of the page table entries. When a logical
address is generated by the CPU its page number is presented to the
TLB. If the page number is found, its frame number is immediately
available and is used to access memory. If the page number is not in
the TLB known as TLB miss, a memory reference to the page table
must be made. When the frame number is obtained, it can be used to
access memory. Some TLB’s allow entries to be wired down, that is
they cannot be removed from the TLB. TLB entries for kernel code
are wired down.
5
Paging in Operating System
Paging is a memory management scheme that eliminates the
need for a contiguous allocation of physical memory. The
process of retrieving processes in the form of pages from the
secondary storage into the main memory is known as paging.
The basic purpose of paging is to separate each procedure into
pages. Additionally, frames will be used to split the main
memory. This scheme permits the physical address space of a
process to be non – contiguous.
8
Some TLB’s store address space identifiers (ASIDS) in each
TLB entry. An ASID uniquely identifies each process and is
used to provide address space protection for that process. An
ASID allows the TLB to contain entries for several different
processes simultaneously. If the TLB does not support separate
ASIDs, then every time a new page table is selected, the TLB
must be flushed or erased to ensure that the next executing
process does not use the wrong translation information.
The percentage of times that a particular page number is found
in the TLB is called the hit ratio. To find the effective memory
access time, each case is weighted by its probability.
What is Paging Protection?
Memory protection in a paged environment is accomplished by
protection bits associated with each frame. These bits are kept in
the page table. One bit can define a page to be read – write or
read – only. Every reference to memory goes through the page
table to find the correct frame number. When the physical
address is being computed, the protection bits can be checked to
verify that no writes are being made to a read- only page. An
attempt to write to a read – only page causes a hardware trap to
the OS.
One additional bit is generally attached to each entry in the page
table – a valid – invalid bit. When this bit is set to valid, the
associated page is in the process’s logical address space and is
thus a legal page. When the bit is set to invalid, the page is not
in the process’s logical address space. OS sets this bit for each
page to allow or disallow access to the page.
Some systems provide hardware in the form of a page table
length register (PTLR) to indicate the size of the page table.
This value is checked against every logical address to verify that
the address is in the valid range for the process. Failure of this
test causes an error trap to the OS.
9
Example of Paging
Here is an example. Let’s say the main memory size is 64B and the
frame size is 4B then, the number of frames would be 64/4 = 16.
There are 4 processes. The size of each process is 16B and the page
size is also 4B then, the number of pages in each process = 16/4 = 4.
These pages may be stored in the main memory frames in a non-
contiguous form, depending on their availability.
10
Paging in OS: Page Table
If we speak of paging in the operating system, the logical and
physical memory addresses are separated. As a result, an address
translation mechanism is required to convert the logical address into a
physical address. The physical address is the actual address of the
frame where each page will be placed, whereas the logical address
space is the address created by the CPU for each page.
11
Every new process creates a separate page table (stored in physical
memory). A page table entry contains a variety of page-related
information. The information contained in the page table item differs
from one operating system to another. PTE has the following
information:
Advantages of Paging
Paging allows operating systems to use physical memory more
efficiently and improves system performance. Key paging advantages
are:
13
currently in use onto the disk and then swaps them back in when
needed.
Improving memory usage. Paging improves performance by
reducing the time the CPU waits for pages to load from the disk.
The operating system keeps the most frequently used pages in
memory and only swaps out the pages not used as often.
Simplifying memory management. Paging streamlines
memory management for the operating system. Therefore, the
OS only has to keep track of the pages currently in memory
rather than the entire address space of each process.
Efficient swapping. With paging, the operating system does not
have to consider fragmentation when swapping out a page.
Moreover, the OS chooses the page least likely to be used.
Supports virtual memory. Virtual memory support means each
process has its own address space, even if the physical memory
is not large enough to accommodate all the processes.
Disadvantages of Paging
Paging is a very effective way to use physical memory, but it also
adds complexity to the OS and causes page faults. While the
advantages outweigh the disadvantages, the following list represents
key drawbacks:
14
Page table overhead: Paging requires page tables, which
consume significant memory. Multilevel page tables and
variable page sizes (super-pages) mitigate the issue.
CONCLUSION
Paging is a storage mechanism that allows OS to retrieve processes
from the secondary storage into the main memory in the form of
pages .The paging process should be protected by using the concept
of insertion of an additional bit called Valid/Invalid bit . The biggest
advantage of paging is that it is easy to use memory management
algorithm. Paging may cause Internal fragmentation.
Paging helps in improving the performance of the system by
improving the utilization of the memory and accessing the available
memory present there. Paging and segmentation both are the memory
management schemes. Paging allows the memory to be divided
into fixed sized block whereas the segmentation, divides the memory
space into segments of the variable block size. Where the paging leads
to internal fragmentation the segmentation leads to external
fragmentation. Paging divides memory into sections or paging files.
When a computer uses up its available RAM, pages not in use are
transferred to the hard drive using a swap file. A swap file is a space
set aside on the hard drive to be used as the virtual memory extension
for the computer's RAM.
REFERENCE
15
I. Alderson, W. C. Lynch and B. Randell. "Thrashing in a
Multiprogram Paging System", from Operating Systems
Techniques, ed. Hoare and Perrott, Academic Press, pp. 152—
167,1968.
16