When Does Page Fault Occur?

Learn via video courses
Topics Covered

A page fault is a trap that occurs when the requested page is not loaded into the memory, in other words, when a program tries to access a chunk of memory that does not exist in physical memory (main memory) causes a page fault.

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

What is a Page Fault in the OS?

In operating systems, a page fault is an exception/error that is raised by the memory management unit if a process accesses a memory page without it being loaded into the memory. A mapping is required to be added to the virtual address space of the process to access the page. The page contents are loaded from a backing store (secondary storage), such as a disk. The page fault is detected by the memory management unit, but the operating system's kernel handles the exception by making the required page accessible in the physical memory or denying illegal memory access.

page fault in the OS

Describe the Actions Taken by the Operating System When a Page Fault Occurs.

When a page fault occurs, the following sequence of events happens:

  1. At first, an internal table is created to process whether the reference was valid or invalid memory access.
  2. The system gets terminated if the reference becomes invalid, if not, the page will be paged in.
  3. After checking for validity, the free-frame list searches the system for a free frame.
  4. The disk operation will be scheduled to get the required page from the disk.
  5. The page table of the process will be updated with a new frame number, and the invalid bit will be changed after the completion of the I/O operation. Now it is a valid page reference.
  6. Restart these steps upon finding any more page faults.
Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course

Learn About Page Replacement Algorithms

A page replacement algorithm is needed to decide which page needs to be replaced when a new page comes in. These are used in operating systems that use paging for memory management.

To learn more about page replacement algorithms, follow the below link

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Conclusion

  • Page faults occur when a requested page is not loaded into the memory.
  • Page faults are detected by the Memory Management Unit (MMU).
  • Page replacement algorithms are used to minimize the number of page faults.