I am working on a page cache replacement policy, I read many existing algorithms most of them are prefer to retain modified pages in cache. I don’t really understand the reason behind it. Is it due to eviction cost or modified pages have higher chance of being used again?
Share
Out of many different policies LRU(least recently used) policy provides good result with hardware support.
Is it due to eviction cost or modified pages have higher chance of being used again?Yes
So according to locality of reference the recently modified page has more chances of being referenced again.
One more reason of retaining modified page in cache is that every page replacement of modified page (which has higher chances of being referenced again)requires two transfers. Firstly it is written into disk and secondly requested page comes in main memory. This very costly. But in case of non modified page (which has low chances of being referenced) only one transfer takes place i.e. requested page comes in memory.