4

From Stephen's reply and comment at https://unix.stackexchange.com/a/289446/674:

in some cases, data which has been marked for paging out but hasn't yet been paged out.

paging out would indeed involve accessing the disk, but that's another operation which doesn't have anything to do with the page fault: there's a marking operation, a separate paging out operation (which hasn't happened yet), and the page fault which causes the memory to be retrieved (so the page-out probably won't happen at all). Even in (3), servicing the page fault doesn't involve touching the disk (the data isn't there yet), so it's a minor page fault.

  1. What does "the page fault which causes the memory to be retrieved (so the page-out probably won't happen at all)" mean?

    Why won't the page-out probably happen at all?

  2. Why "servicing the page fault doesn't involve touching the disk"?

    Is the reason for not paging-out yet in "data which has been marked for paging out but hasn't yet been paged out" that the data needed isn't on the disk yet?

Thanks.

1 Answer 1

7

Regarding your first question, a page-out involves a page of memory which (for whatever reason) doesn't need to be kept in physical memory; but the removal of a page isn't necessarily instantaneous. If, between the time the page is determined to be unnecessary and the time it's actually paged out, a page fault causes the page to be "pulled in" again, then the page fault can be serviced immediately without a page-in (so it's minor), and because the page in question is now needed in main memory again, it shouldn't be paged out.

An analogy which may help is the returns cart in a library. When you return a book, it's placed on the cart, and at some point the whole cart is taken and the books it holds are placed in the shelves. Between the time you return the book and the time it is returned to the shelf, someone else may request the book and retrieve it from the cart, which is faster than retrieving it from the shelf...

Regarding your second question, it's simply the definition of a minor page fault: if a page fault doesn't involve touching the disk, it's minor, otherwise it's major. In the example, servicing the page fault doesn't involve touching the disk, because the page was "caught" before it was discarded from memory — and this remains true even if the page has actually been written out to disk ("touching the disk" then was related to the page-out, not the page fault).

Hopefully that clarifies things!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .