I have been reading the textbook "Operating System Concepts, Edition 10 by Greg Gagne, Peter B. Galvin, Abraham Silberschatz"
The textbook first says the following about a modified bit on page 403 ...
"If the bit is set,we know that the page has been modified since it was read in from secondary storage. In this case, we must write the page to storage. If the modify bit is not set, however, the page has not been modified since it was read into memory. In this case, we need not write the memory page to storage: it is already there."
However later in the book, page 410-411 it seems to contradict...
"We can enhance the second-chance algorithm by considering the reference bit and the modify bit (described in Section 10.4.1) as an ordered pair. With these two bits, we have the following four possible classes:
1. (0, 0) neither recently used nor modified—best page to replace
2. (0, 1) not recently used but modified—not quite as good, because the page will need to be written out before replacement
3. (1, 0) recently used but clean—probably will be used again soon
4. (1, 1) recently used and modified—probably will be used again soon, and the page will be need to be written out to secondary storage before it can be replaced
Each page is in one of these four classes. When page replacement is called for, we use the same scheme as in the clock algorithm; but instead of examining whether the page to which we are pointing has the reference bit set to 1, we examine the class to which that page belongs. We replace the first page encountered in the lowest nonempty class. Notice that we may have to scan the circular queue several times before we find a page to be replaced. The major difference between this algorithm and the simpler clock algorithm is that here we give preference to those pages that have been modified in order to reduce the number of I/Os required."
If we are giving preference to pages that have been modified does that not mean that we are increasing the number of IO required? Because if the page has been modified then we need to write that change into the storage?
Sorry I'm confused how the enhanced second-chance algorithm is supposed to reduce the number of IO required.
Thank you.