1

Quoting from: http://www.cburch.com/books/vm/index.html

The final bit (labeled P) indicates whether the page is present in RAM. If this bit is 0, then any access to the page will trigger a page fault.

My professor doesn't agree, he said the bit can be 0 while page is in RAM and he added that this can happen when the page is shared between multiple processes and someone does something or so.

Can someone kindly explain this, still I don't get it I'm looking for detailed examples when page is in RAM but it's present bit in PTE is 0 and not 1.

Dan
  • 99
  • 6
  • What your professor said doesn't technically disagree with that quote from the link. Each process could have it's own PTE for that same page. If for one process, the present bit for one page is 0 and that process tries to access that page, it will definitely cause a page fault. The book isn't saying that if the present bit is 0 then it isn't in RAM. It may or may not be in RAM, but needs to be mapped correctly before that process can use the page. – wxz Oct 05 '21 at 16:18
  • @wxz I know but I was looking to example where this can be the case. – Dan Oct 06 '21 at 16:26
  • 1
    One way I can see this happening is thinking about a shared page. Imagine process A and process B use the same shared page. They both map the page and have their own PTE for the page with present bit set to 1. Then the page gets chosen to be evicted, both PTEs are set to not present. Process B reads the page again, the page is put into RAM and the PTE for B is set to present. At this moment, when process A tries to read the page, the PTE for A is still marked not present, but we know that the page is in RAM. I think this case is called a soft page fault, because it requires no disk I/O. – wxz Oct 06 '21 at 16:48

1 Answers1

0

Yes, It's possible to have a page in RAM with p-bit disabled. This method was useful while creating a software/kernel with multi-threading and multi-processor environment, where a process needs exclusive rights or if a piece code must not cross some other. We can temporarily disable it's access to other core/processor by demoting p-bit in page-table and the kernel/software must handle the page fault accordingly.

Neeraj
  • 1