edited by
23,521 views
63 votes
63 votes

Assume that a main memory with only $4$ pages, each of $16$ bytes, is initially empty. The CPU generates the following sequence of virtual addresses and uses the Least Recently Used (LRU) page replacement policy.

$\text{0, 4, 8, 20, 24, 36, 44, 12, 68, 72, 80, 84, 28, 32, 88, 92}$

How many page faults does this sequence cause? What are the page numbers of the pages present in the main memory at the end of the sequence?

  1. $6$ and $1, 2, 3, 4$
  2. $7$ and $1, 2, 4, 5$
  3. $8$ and $1, 2, 4, 5$
  4. $9$ and $1, 2, 3, 5$
edited by

6 Answers

1 votes
1 votes
Word addresses are given in decimal(2 bits) therefore 10^2 words are possible by the process (0-99) . Assuming memory to be byte addressable 100 words = 100 bytes. Now each line contains 16 bytes, hence to find the page number where the word belong to, just divide the word generated by line size(16) floor (word/16) will give us page number. Further the task becomes easy, just apply algorithm given according to page numbers.
0 votes
0 votes
answer that I am getting is 7 page faults and 3,6,2,5 pages in main memory :(
Answer:

Related questions

35 votes
35 votes
5 answers
3