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
1
vote
1 answer

page fault in operating system.(invalid addressing or page not in main memory)

i am reading about page faults in demand paging. page faults happen when 1) the memory being is accessed is illegal 2)the page is valid but not present in main memory i read that with valid-invalid bit you can tell if the memory is not in…
SuperAadi
  • 627
  • 1
  • 6
  • 15
1
vote
0 answers

How many minor faults is my process *really* taking?

I have the following simple program, which basically just mmaps a file and sums every byte in it: #include #include #include #include #include #include #include…
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
1
vote
0 answers

Argument Passing and Stack Setup in C

I am currently trying to implement argument passing for part of a project in my operating systems course. We need to parse and tokenize a file name, and store (using memcpy) the values of the arguments, pointers to the arguments, and a few other…
theRook
  • 43
  • 7
1
vote
1 answer

Kprobe mechanism to intercept do_page_fault

Im trying to intercept the __do_page_fault() method in linux kernel. The normal way to register kprobes , i.e. defining kp.addr as kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("__do_page_fault"); is not working. What's the proper way to do…
Sayak
  • 25
  • 1
  • 5
1
vote
0 answers

Benchmarking mmap and output of /usr/bin/time, htop and the like

I have a program which makes heavy use of memory mapping files into virtual memory, in particular files much larger than physical memory. The performance of the program is not exactly brilliant. Given the setup, major page faults may be the culprit.…
Harald
  • 4,575
  • 5
  • 33
  • 72
1
vote
0 answers

Passing non-dword arguments onto stack causes page fault?

I'm currently reading through Irvine 6th ed. to teach myself assembly, and I've come across this sentence on page 277 (section 8.2.2, 'Accessing Stack Parameters', sub-heading 'Passing 8-Bit and 16-Bit Arguments on the Stack'), and it states: …
sarcopsy
  • 11
  • 2
1
vote
1 answer

Why wall clock is very much higher than cpu user/kernel time

In my application written in C++, I am getting below time information. 0.46u CPU user time 1.27s CPU kernel time 41.83s Real wall clock 4% CPU% usage. 0 Major page faults 207848 No. of file system outputs. 100269 minor page faults. 82: No. of times…
quartz
  • 747
  • 9
  • 26
1
vote
1 answer

ARM Kernel Oops when interrupts are enabled in page fault handler or with preemptive scheduling

Can you enable interrupts in page fault handler? Is there an ARM kernel contention with preemptive scheduling? I got an ARM kernel oops in UDP receiving code with CONFIG_PREEMPT, or when interrupt is enabled in fault handler. The problem is…
minghua
  • 5,981
  • 6
  • 45
  • 71
1
vote
1 answer

Page Fault Exception Handlers and Updating Page Tables

In reading about how page faults and page hits are handled by the page fault exception handler, one thing wasn't clear to me. If a process is using a shared page and a page fault happens, when the page fault exception handler updates the page table…
user1028730
  • 143
  • 1
  • 1
  • 6
1
vote
2 answers

Performance tuning , detecting and page faults

I am trying to Tune one of my applications on JAVA. I am using JAVA-Profiler and got some reports from it. I saw that the number of page -faults for application are ranging from 30000 to 35000 range. How can I decide if this number is too high or…
Learn More
  • 1,535
  • 4
  • 29
  • 51
1
vote
1 answer

Virtual memory - Page on RAM and in hard drive at the same time?

Can a page be, at the same time, in physical memory and in virtual memory? If I ask for an address that's on virtual memory, will it always trigger a page fault? If the first question is true, then it should only trigger a page fault if the page is…
Alvaro VS
  • 203
  • 1
  • 5
  • 15
1
vote
1 answer

Page fault and dirty pages

I have started reading about CPU caches and I have two questions: Lets say the CPU receives a page fault and transfers control to the kernel handler. The handler decides to evict a frame in memory which is marked dirty. Lets say the CPU caches are…
Bruce
  • 33,927
  • 76
  • 174
  • 262
1
vote
0 answers

Identify Windows Process Page Fault cause

On Windows I use a commercial software that to perform a certain task can run even for 18 hours. By inspecting the task manager the process reports a huge amount of page faults, something like 65M page faults and a memory usage peak aroung…
1
vote
2 answers

measure number page faults happened of a program on Linux

I am doing a project on Linux scheduler that tries to minimize number of page faults. I have finished the algorithm implementation, and I need to measure the effect. I am wondering if Linux provides tools to the record number of page faults that…
Alfred Zhong
  • 6,773
  • 11
  • 47
  • 59
1
vote
2 answers

Why there is no SIGSEGV signal on copy on write?

The copy-on-write article on wikipedia says that copy-on-write is usually implemented by giving read only access to the pages, so that when one is written, the page fault trap handler can map a unique physical memory page for it. So my question is…
pythonic
  • 20,589
  • 43
  • 136
  • 219