operating-systemtheorypage-fault

Can page fault occur if we don't use virtual memory?


I was reading about Virtual Memory and Page Fault. From what I understand, Page Fault occurs when the page CPU is looking for is not present in the Main Memory. I had a doubt that, can page fault occur if we don't not use virtual memory?


Solution

  • Can page fault occur if we don't use virtual memory?

    It depends on how you define "virtual memory".

    In some contexts, "virtual memory" just means "using the CPU's MMU/paging". In this case, no you can't get a page fault if you don't use the CPU's MMU/paging.

    In some contexts, "virtual memory" means the use of some tricks to improve things like RAM consumption (e.g. swap space, memory mapped files, "copy on write", etc). In this case it's possible to not use any tricks but still use CPU's MMU/paging (e.g. 64-bit environments on 80x86, like UEFI, where the physical memory is identity mapped so that there's no difference between virtual addresses and physical addresses). In this case it is possible to have page faults even though you're not using any tricks.