Sunday 15 January 2012

paging - Calculating cache memory based on LRU algorithm -



paging - Calculating cache memory based on LRU algorithm -

assuming have 4 blocks of cache memory, using lru (least used) replacement algorithm on next sequence of access memory blocks: 1 2 3 4 5 2 5 4 1 5 2 3 :

1 2 3 4 5 2 5 4 1 5 2 3 1 1 1 1 5 5 5 5 5 5 5 5 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 1 1 1 1 4 4 4 4 4 4 4 4 3

so in end, cache memory contains memory blocks : "5 2 1 3"

but right result "1 5 2 3"

please tell me doing wrong here!

edit:

i honest, i'm doing excercise , can't help anywhere here, , may misread question, original question :

so simulation of lru wrong? still don't it!

the simulation goes awry in column 5 add together newest info oldest position.

here's correction:

1 2 3 3 3 2 2 4 1 <-- oldest accesses 1 2 3 4 4 2 5 4 1 5 1 2 3 4 5 2 5 4 1 5 2 1 2 3 4 5 2 5 4 1 5 2 3 <-- newest accesses notice newest row equal input sequence. the other elements age 1 row @ time unless brought front end new access

paging lru

No comments:

Post a Comment