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

Resident memory of process increasing but no Major Page Faults

I have created the bellow small c program which allocates 50Mb of memory using malloc() and then using a loop to "touch" every page in order to make it residence. int main () { // Map 50M to RAM unsigned char *p = malloc(52428800); sleep(5); …
giomanda
  • 177
  • 9
0
votes
0 answers

Heap Gives Page Fault

I am now getting a page fault which means i am accessing an invalid address. This is most likely to the higher half kernel design i chose to follow. But i could not see where it leads to a page fault. Here is my kernel.c++ #include…
amanuel2
  • 4,508
  • 4
  • 36
  • 67
0
votes
0 answers

Bootloader Page Fault

So today I was creating another bootloader, and thought that it would be nice if I would be able to use power of 64 bit processors. Everything seems to be running fine until my bochs start to restart due to Page Fault. NOTE: parts of code is copied…
vakus
  • 732
  • 1
  • 10
  • 24
0
votes
1 answer

What fault occurred if flags stored in the tlb doesn't match?

If my understanding is not wrong, TLB stores not only virtual to physical address mappings, but also each page's flag such as writable flag(W), execute disable(XD) flag. My question is what faults will be generated, if it tries to execute…
ruach
  • 1,369
  • 11
  • 21
0
votes
1 answer

How page faults are handled with Page Size Extension?

I was trying to understand the concept of Page Size Extension, used in x86 processor but was not able to relate it with the page fault mechanism. From my understanding, when a page fault occurs, the virtual address is written in a register and an…
Rahul Jain
  • 67
  • 1
  • 2
  • 8
0
votes
3 answers

CoreOS VM crash: swap trace printed

I'm using CoreOS 773.1.0 with kubernetes. Recently it crashes and printed this trace log: The VM is still running but I cannot ssh to it, kubernetes master node declare it as NotReady. I had to turn it off (not shutdown) and start it. I'm using…
Quyen Nguyen Tuan
  • 1,677
  • 17
  • 23
0
votes
2 answers

High number of page faults has any relation to memory fragmentation?

I want to know if a program that shows high number (or the highest in the system ) of page faults, lets say into Task Manager or Process Explorer, that is an indication of memory fragmentation. Is there any other way to reveal this kind of problem?…
Stathis Andronikos
  • 1,259
  • 2
  • 25
  • 44
0
votes
0 answers

How to know page faults happened on a specific memory mapped area

The total page faults on a process can be obtained by /proc//statm, but how can I know how many happened on a specific mmaped area? Thanks
Bill Randerson
  • 1,028
  • 1
  • 11
  • 29
0
votes
0 answers

Why does cost to access unmanaged memory in C# occasionally reach 120ms?

I use Marshal.AllocHGlobal to allocate several huge chunks (100MB each) of unmanaged memory in my C# application (in Windows). I use these to allocate smaller pieces of unmanaged memory. After benchmarking these smaller allocations, I recognized…
0
votes
1 answer

round robin job scheduling w/ page faults

I have a list of jobs with Job#, CPU Time, Arrival time, page faults. I eventually need to code the process in java but for now i'm just trying to understand how it processes through the jobs with a 10ms time quantum and accounts for the page…
0
votes
0 answers

How to deliberately cause page faults?

I have a windows service that crawls web pages using multi-threading, occasionally I am getting connections resets due to the TCP window becoming full. I suspect it has something to do with the page faults that are occurring around the time of the…
Imran Azad
  • 1,008
  • 2
  • 12
  • 30
0
votes
1 answer

Calculating number of page faults in two dimensional array

//1) #include int A[1024][1024]; int main(void) { int i, j=0; for (i=0 ; i < 1024 ; i++) { for (j=0 ; j < 1024 ; j++) { A[i][j] = 0; // } } } // 2) #include int…
0
votes
1 answer

FIFO Page Replacement Algorithm - Counting Page Faults

I'm currently reading about Page Replacement Algorithms, and have been looking at a couple of examples with regards to the FIFO (First In, First Out) method. My question is as follows; how do you count the number of page faults, as I have seen…
yulai
  • 741
  • 3
  • 20
  • 36
0
votes
1 answer

Does MongoDB yield lock on index page fault?

During an update, if the part of index that needs to be updated is not in memory, will MongoDB yields the write lock during the index page fault? The documentation mentions about yield on page faults. Does it apply to page faults in index too or…
Chandra Sekar
  • 10,683
  • 3
  • 39
  • 54
0
votes
1 answer

How does a processor know that a page is not mapped in main memory but is in backing store?

In the X86 architecture how does a processor know that a page is not mapped in main memory but is in backing store, is their a flag in the page table entry that indicates that or is it only after the translation into physical address that the…
S. Aditya
  • 35
  • 4
1 2 3
12
13