[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Page Faults Defined



On Thu, 2002-09-26 at 04:50, martin f krafft wrote:

> i am repeatedly seeing the term "page fault" being used in Debian in
> the wrong way.

(examples?)

> A page fault, despite its name, has nothing to do with
> memory corruption or an invalid access.

It has quite a bit to do with an invalid access. As far as the MMU is
concerned, it *is* an invalid access: There is no page mapped to the
address, and thus it throws a (hardware) exception called a 'page
fault'.

Please check your friendly CPU data book ;-)

> A page fault simply occurs
> when a memory access causes the memory management system to have to
> fetch the requested page from swap.

Not quite. Page faults can be satisfied from things besides disk as
well. Example: bringing in part of an ELF fragment from the page cache.
Example: first write to newly allocated (in the kernel's view) memory.
Example: High-mem support.

Even things like copy-on-write pages (from, e.g., fork) generate
something that might be called a page fault on the first write attempt.
So does an attempt to write to null.

> invalid accesses to memory, like
> dereferencing null pointers or writing beyond the end of protected
> storage cause segmentation faults or bus errors.

Writing off of allocated memory causes a page fault as well (are there
microprocessors on which it doesn't?), but the kernel notices that it
can't do anything about it, and kills the program.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: