---
title: "What is Page fault and when  does page fault error occur in Operating System?"  
description: "What is Page fault and when  does page fault error occur in Operating System?"  
author: "Kalin"  
published: 2022-04-04  
canonical: https://answers.mindstick.com/qa/96703/what-is-page-fault-and-when-does-page-fault-error-occur-in-operating-system  
category: "troubleshooting"  
tags: ["troubleshooting", "operating systems"]  
reading_time: 2 minutes  

---

# What is Page fault and when  does page fault error occur in Operating System?

What is [Page fault](https://www.mindstick.com/forum/157660/what-is-page-fault-how-is-page-fault-handling-in-os) and when does page fault [error](https://www.mindstick.com/forum/459/iis-7-error-503-service-unavailable) occur in Operating System?

## Answers

### Answer by Hitesh Vohra

- When a **software tries to access data or code** that is in its address space but not already in the system RAM, a **[page](https://www.mindstick.com/articles/85722/common-on-page-seo-mistake-how-to-fix) fault occurs.** When there is a page fault, the following sequence of events occurs:
- The programme counter (PC) is saved on the stack after the computer hardware traps to the kernel. Information about the current state of an instruction is recorded in CPU registers.
- To prevent the OS from deleting the general registers and other volatile information, an assembly programme is started.
- Once the virtual address that produced the page fault is identified, the system checks to determine if the address is genuine and if there is no problem with protected access.
- If the virtual address is correct, the system looks for a free page frame. The page replacement algorithm is used to remove a page if no frames are available.
- If the specified frame is dirty, the page is scheduled for disc transfer, a context switch occurs, the fault process is suspended, and another process is started until the disc transfer is completed.

\

**Read More[: What are the advantages of multithreaded programming in Operating System?](https://answers.mindstick.com/qa/96698/what-are-the-advantages-of-multithreaded-programming-in-operating-system)**


---

Original Source: https://answers.mindstick.com/qa/96703/what-is-page-fault-and-when-does-page-fault-error-occur-in-operating-system

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
