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 logical address space,because the corresponding bit will be marked invalid.
the same valid-invalid bit is used to identify the above 2 condition.
my question how does the os know if the memory being accessed is illegal or if the page is valid but not in main memory with just one valid-invalid bit? thank you!
In Demand Paging if the
valid-invalid bit
is set(1), it means that the associatedpage
is both legal and in memory. However if thevalid-invalid bit
is not set(0), it means the following:page
is not valid. It means that page is not in processlogical address space
. ORpage
is ondisk
.The invalid page access causes a page-fault trap. And we handle it in the following way. Quoting from Operating Systems principles by Silberschatz, Galvin, Gagne