Professional Documents
Culture Documents
ABSTRACT
In the memory management system, the page replacement algorithm is an inevitable concept.
When the Kernel creates a process, the pages are required to be in the main memory. If the
pages are not found in the main memory [4], then it is called page fault.
A page fault is an essential concept in computer memory management and virtual memory
systems. It occurs when a program or process attempts to access a specific page of memory
that is currently not in physical RAM (Random Access Memory). When this happens, the
operating system intervenes to handle the page fault and bring the required page into physical
memory, making it accessible to the program.
INTRODUCTION
In modern computing, paging and memory swapping are two common memory management
techniques for the allocation and de allocation of memory. Memory management can be used
to reduce fragmentation of a program's address space, improve performance by reducing cache
misses, or increase security by preventing buffer overflows.
The memory management unit (MMU) maps logical addresses to physical addresses while
managing the movement of processes between the storage disk and main memory during
execution.
In this article, we’ll examine pertinent issues with page faults and memory swaps as
commonly occurring exceptions. We’ll also look at the typical scenarios that cause them.
Page Fault:
A page fault (sometimes called #PF, PF or hard fault)[a] is a type of exception raised by
computer hardware when a running program accesses a memory page that is not currently
mapped by the memory management unit (MMU) into the virtual address space of a process.
Logically, the page may be accessible to the process, but requires a mapping to be added to
the process page tables, and may additionally require the actual page contents to be loaded
from a backing store such as a disk. The processor's MMU detects the page fault, while the
exception handling software that handles page faults is generally a part of the operating
system kernel.
When handling a page fault, the operating system tries to make the required page accessible at
the location in physical memory or terminates the program in cases of an illegal memory
access.
If the page is loaded in memory at the time the fault is generated, but is not marked in the
memory management unit as being loaded in memory, then it is called a minor or soft page
fault.
This is the mechanism used by an operating system to increase the amount of program
memory available on demand. The operating system delays loading parts of the
program from disk until the program attempts to use it and the page fault is generated. If
the page
is not loaded in memory at the time of the fault, then it is called a major or hard page
fault.
If a page fault occurs for a reference to an address that is not part of the virtual
address space, meaning there cannot be a page in memory corresponding to it, then it
is called an invalid page.
Demand paging:-
the operating system copies a disk page into physical memory only if an attempt is
made to access it and that page is not already in memory (i.e., if a page fault occurs). It
follows that a process begins execution with none of its pages in physical memory, and
many page faults will occur until most of a process's working set of pages are located
in physical memory.
Advantages
Disadvantages
Low-cost, low-power embedded systems may not have a memory management unit
that supports page replacement.
Possible security risks, including vulnerability to timing attacks; see Percival, Colin
(2005-05-13). "Cache missing for fun and profit" (PDF). BSD Can 2005.
(Specifically the virtual memory attack in section 2).
Individual programs face extra latency when they access a page for the first time.
[GOVERNMENT POLYTECHNIC
Page 7
[PAGE
FIFO Algorithm
This is the simplest page replacement algorithm. In this algorithm, the operating system
keeps track of all pages in the memory in a queue, the oldest page is in the front of the
queue. When a page needs to be repage in the front of the queue is selected for
removal. Example-1:- Consider page reference string 1, 3, 0, 3, 5, 6 with 3 page
frames. Find number of page faults. : - This is the simplest page replacement
algorithm. In this algorithm, the operating system keeps track of all pages in the
memory in a queue, the oldest page is in the front of the queue. When a page needs to
be repage in the front of the queue is selected for removal. Consider page reference
string 1, 3, 0, 3, 5, 6 with 3 page number of page faults. This is the simplest page
replacement algorithm. In this algorithm, the operating system keeps track of all pages
in the memory in a queue, the oldest page is in the front of the queue. When a page
needs to be replaced.
Conclusion
Page Fault in OS, Page errors are more often than other errors. If software tries to
access memory not present in physical memory, a page fault will occur (main
memory).
[GOVERNMENT POLYTECHNIC Page
[PAGE
The fault instructs the operating system to move all data from secondary memory to its
primary memory, which might be a hard drive, by tracing it into virtual memory
management.
References
[GOVERNMENT POLYTECHNIC Page
[PAGE
https://www.studocu.com
https://datatrained.com