Page fault occurs when a program attempts to access a memory that is not stored in physical memory or in RAM . This fault informs the operating system that it must locate the data in virtual memory, then it is transferred from storage device such as HDD or SSD to system RAM .
Although this term “ page fault ” sounds like an error, but page faults are more common and at the same time they are part of the common ways that computers handle virtual memory. Programming terms, a page fault generates an exception, which notifies the operating system that it must retrieve memory blocks or ” pages ” from virtual memory so that the program can continue.
Once the data is moved to physical memory, then the program continues to run normally. This process is going on in the background and often it is not even visible to the users.
Most page faults are handled without any problems. But due to an invalid page fault, a program can either hang or crash. This type of page fault arises when a program tries to access a memory address which is not actually mehjud. Some programs can handle this type of errors in which they find a new memory address or relocate the data.
But, if the program cannot handle the invalid page fault then it is passed to the operating system, which can also terminate this process. This causes that sometimes the program suddenly quit.
By the way, page faults are quite common when working in virtual memory, every page fault requires transferring the data from secondary memory to primary memory. This process takes only a few milliseconds to happen, but it still slows down thousands of times if we compare it to accessing data from memory. In such a situation, by installing more system memory, it increases the performance of the computer, because it has to reduce the access to virtual memory significantly.