0

So this is not a homework question. It's a question from a previous exam my professor posted as resource to help us study for our midterm. However, there are two answers that (to me) seem like they could be the correct answer.

A.) A page fault means the physical page to be replaced must be saved to the hard disk. B.) The requested virtual is not in the physical memory.

Now, it is my understanding that a page fault is when the data stored in the physical memory page is not the data you need, therefore, you need to access the hard drive and load the correct data. Also, if the dirty flag is 1, then that means the previous data in physical memory has been modified, therefore you need to re-save that to the disk.

Therefore, it seems to me that both A and B are right, but I was wondering if anyone could tell me what they think the better option is.

If I were forced to choose I would say A.

SIDE NOTE I have emailed the professor about the answer but he's really bad about responding and hasn't emailed me back yet.

Drew
  • 51
  • 2
  • 9
  • http://en.wikipedia.org/wiki/Page_fault - all you need is the first sentence. Don't confuse the very specific hardware event of a "page fault" with the more general "paging algorithm" – Matt Nov 09 '12 at 19:00
  • Okay, thanks for the help. Guess I would have been wrong then! – Drew Nov 09 '12 at 19:06

1 Answers1

1

Neither of these is correct.

A.) A page fault means the physical page to be replaced must be saved to the hard disk.

This is not correct because it could also mean the page needs to be read from the hard disk.

B.) The requested virtual is not in the physical memory.

This is not correct because in a soft page fault, the page is resident in physical memory. For example, the operation may just be the first write to a resident, unshared page, so the page has to be marked dirty. Or the page may be shared and need to be unshared. In these cases, the requested virtual page is resident in physical memory, it just needs some massaging by the memory management system.

A page fault means some help from the kernel is needed in order to permit the access to that page of virtual memory. The help needed could vary from reading the page in to disk to just marking the page accessed so the kernel knows not to evict it.

Of those two, B is probably closer to correct because A is almost never right. The "classic" page fault would be if the page had to be read in from hard disk, which B would apply to but not A.

Now, it is my understanding that a page fault is when the data stored in the physical memory page is not the data you need, therefore, you need to access the hard drive and load the correct data. Also, if the dirty flag is 1, then that means the previous data in physical memory has been modified, therefore you need to re-save that to the disk.

How could the page both be dirty and not hold the data you need? If it's dirty, that means you dirtied it. Which means it's holding the data you're working with.

David Schwartz
  • 179,497
  • 17
  • 214
  • 278
  • I'm guessing B would have been the correct answer. Our book defines page fault as "An event that occurs when a accessed page is not present in main memory." – Drew Nov 10 '12 at 19:32
  • @Drew While that statement is true, that's not a proper definition of a page fault since page faults can happen for other reasons. It's a tolerable, but not great, definition of a hard page fault. – David Schwartz Mar 05 '17 at 07:18