26.07.2013 Views

I/O Devices and disk scheduling - Csbdu.in

I/O Devices and disk scheduling - Csbdu.in

I/O Devices and disk scheduling - Csbdu.in

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

that block that has been <strong>in</strong> the cache longest with no reference to it. Logically, the cache<br />

consists of a stack of blocks, with the most recently reference block on the top of the<br />

stack.<br />

Another possibility is least frequently used (LFU): Replace the block that is not<br />

frequently used. The LFU can be implemented by associat<strong>in</strong>g a counter with each block.<br />

When a block is brought <strong>in</strong>, it is assigned a count of 1; with each reference to the block,<br />

its count is <strong>in</strong>cremented by 1. When replacement required, the block with smallest count<br />

is selected. One problem of LFU is the effect of locality may actually cause the LFU<br />

algorithm to make poor replacement choices.<br />

is proposed.<br />

To overcome this difficulty, a technique known as frequency-based replacement<br />

New section Old section<br />

MRU LRU<br />

Re-reference;<br />

count unchanged Re-reference<br />

Miss(new block brought <strong>in</strong>)<br />

count :=1<br />

Count:=count+1<br />

(a) FIIFO<br />

New section Middle section Old section<br />

… … …<br />

(b)Use of three sections<br />

Figure 4.8 Frequency-based Replacement<br />

MRU<br />

First consider a simplified version, given figure 4.8 a. The blocks are organized <strong>in</strong> a<br />

stack, as with the LRU algorithm. A certa<strong>in</strong> portion of the top part of the stack is set aside<br />

as a new section. When there is cache hit, the referenced block is moved to the top of the<br />

LRU

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!