Questions tagged [page-fault]

An interrupt that occurs when a program requests data that is not currently in main memory. The interrupt triggers the operating system to fetch the data from a virtual memory and load it into RAM.

A page fault (sometimes #pf or pf) is a trap to the software raised by the hardware when a program accesses a page that is mapped in the virtual address space, but not loaded in physical memory. In the typical case the operating system tries to handle the page fault by making the required page accessible at a location in physical memory or terminates the program in the case of an illegal access. The hardware that detects a page fault is the memory management unit in a processor. The exception handling software that handles the page fault is generally part of the operating system. -- source wikipedia.

Types of page-faults:

MINOR: 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.

MAJOR: 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.

INVALID: 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 fault. --source wikipedia

Handling illegal accesses and invalid page faults:

  • If the program receiving the error does not handle it, the operating system performs a default action, typically involving the termination of the running process that caused the error condition, and notifying the user that the program has malfunctioned.

  • Page faults, by their very nature, degrade the performance of a program or operating system and in the degenerate case can cause thrashing. Optimization of programs and the operating system that reduce the number of page faults improve the performance of the program or even the entire system.
187 questions
0
votes
1 answer

Android illegal memory access - who and how is it handled?

I am trying to debug a problem in which an application is triggering continuous data aborts due to invalid memory access. I have following queries. In general when an application in Android(CPU ARM) is accessing an invalid memory access, what…
Sandeep
  • 18,356
  • 16
  • 68
  • 108
0
votes
2 answers

What happens after segmentation fault in linux kernel?

while I was thinking of making a networked paging (request the faulting page from remote node), I got this question: First, let's consider the following steps: 1) a user-space program tries to access at memory X. 2) MMU walks the page table to find…
jaeyong
  • 8,951
  • 14
  • 50
  • 63
0
votes
1 answer

Should interrupts be enabled in kernel page fault handler in netbsd?

I am seeing an issue where netbsd system kernel is having watchdog timeout and the stack trace shows that kernel page fault handler got interrupted by software interrupt to process ip packets the trace looks like this. This netbsd 4.x 0xcf910db0: at…
krazycoder
  • 53
  • 5
0
votes
1 answer

Which of these answers best describes page fault?

So this is not a homework question. It's a question from a previous exam my professor posted as resource to help us study for our midterm. However, there are two answers that (to me) seem like they could be the correct answer. A.) A page fault means…
Drew
  • 51
  • 2
  • 9
0
votes
3 answers

Page faults and LRU Algorithm

A main memory can retain up to 4 pages. Which page will be the first one to get a page fault if LRU algorithm is used on the following pages that is in order? 1,2,3,1,2,4,1,2,3 This is a test question which I thought there is no answer to. The main…
TtT23
  • 6,876
  • 34
  • 103
  • 174
0
votes
1 answer

Virtual Memory, LRU, and Page Faults - Homework

I've been working on the following program and it feels like it's missing some information or a) and b) are a bit of a trick: The loop is executed as part of a program on a virtual memory system that employs 4KB pages. Assume that an LRU replacement…
-1
votes
2 answers

Calculating page faults with Least Recently Used

I am new to memory management and page replacement algorithms. I found and printed a question about the Least Recently Used algorithm, but unfortunately, I cannot determine if my answer and thought process are correct. I am trying very hard to…
SamSmith
  • 167
  • 1
  • 3
  • 13
1 2 3
12
13