Consider a computer with the following characteristics:

  1. Virtual Memory System: Inter
  2. Cache: 16K bytes, 4-way set-associative, 16 byte blocksize. Physical addresses are used for cache lookups.
  3. TLB: 32 entries, 4-way set-associative

PDBR contains 122f0000

Suppose a user process attempts to read one byte from each of the following virtual addresses. What happens? You may get cache and TLB hits and misses, page faults, protection violations... on actual success, you should give the contents of the addressed byte. In each case, if a failure occurs (page fault or protection violation) you can stop at the earliest opportunity. You can also assume the data is all consistent, so if you have a TLB hit you don't also have to check directory and page table entries. You should try to resolve the memory addresses in the same order the real hardware would: so try to find a translation in the TLB before going to the page tables, and try to find the data in cache before going to memory for it.

  1. 0e67bcb0
  2. 5d0f1fc4
  3. 106f6f4c
  4. 27de9d20
  5. 3a1332f0
Solution:

1. 0e67bcb0
   
    Pick first five, 0e67b. It is  0000 1110 0110 0111 1011. Divide it and we get tag =01ccf ( 0 0001 1100 1100 1111) and set = 3 (011).
    Go to TLB and check, TLB miss.
   
    Divide it again and we get 0e4 (0000 1110 0100 ) and 9ec (1001 1110 1100).
    PDBR contains 122f0000. Plus 0e4 and we get 122f00e4.

    Go to cache and check tag = 122f0, set = 0e and offset = 4, miss.
 
    Check main memory, 122f00e4 gives value 24594007.
    Check permission: 7 is 0111.  It means user accessable, writable and present.

    Remove the last three of  24594007 and plus 9ec. And we find 245949ec gives value 20b77064.
   Check permission: 4 is 0100. It means user accessable, not writable and not present. It will cause Page Fault.

2. 5d0f1fc4
 
    Pick first five, 5d0f1. It is  0101 1101 0000 1111 0001. Divide it and we get tag =0ba1e ( 0 1011 1010 0001 1110) and set = 1 (001).
    Go to TLB and check, TLB miss.
   
    Divide it again and we get 5d0 (0101 1101 0000 ) and 3c4 (0011 1100 0100).
    PDBR contains 122f0000. Plus 0e4 and we get 122f05d0.

    Go to cache and check tag = 122f0, set = 5d and offset = 0, miss.
 
    Check main memory, 122f05d0 gives value 4fc93005.
    Check permission: 5 is 0101.  It means user accessable, not writable and present. Since we do not need to write, it is OK.

    Remove the last three of  4fc93005 and plus 3c4. And we find 4fc933c4 gives value 25eb4021.
   Check permission: 1 is 0001. It means not user accessable, not writable and present. It will cause protection fault.


3. 106f6f4c
 
    Pick first five, 106f6. It is  0001 0000 0110 1111 0110. Divide it and we get tag =020de ( 0 0010 0000 1101 1110) and set = 6 (110).
    Go to TLB and check, TLB hit and valid = 1. We get the value 6e17a003

    Check permission: 3 is 0011.  It means not user accessable, writable and present. It will cause protection fault.
    Go on and check cache and main memory will also give errors.

4. 27de9d20
 
    Pick first five, 27de9. It is  0010 0111 1101 1110 1001. Divide it and we get tag =04fbd ( 0 0100 1111 1011 1101) and set = 1 (001).
    Go to TLB and check, TLB hit and valid =1. We get the value 5616f007
    Check permission: 7 is 0111.  It means user accessable, writable and present.

    Remove the last three of 5616f007 and place d20 after it.
    Go to cache and check tag = 5616f, set = d2 and offset = 0, miss.
 
    Divide 27de9 again and we get 27c (0010 0111 1100 ) and 7a4 (0111 1010 0100).
    PDBR contains 122f0000. Plus 27cand we get 122f027c.

    Check main memory, 122f027c gives value 312ef007.
    Check permission: 7 is 0111.  It means user accessable, writable and present.

    Remove the last three of  312ef007 and plus 7a4. And we find312ef7a4 gives value 5616f027.
    Check permission: 7 is 0111.  It means user accessable, writable and present. It is memory hit.

5. 3a1332f0
 
    Pick first five, 3a133. It is  0011 1010 0001 0011 0011. Divide it and we get tag =07426( 0 0111 0100 0010 0110) and set = 3 (011).
    Go to TLB and check, TLB hit and valid =1. We get the value 686eb047
    Check permission: 7 is 0111.  It means user accessable, writable and present.

    Remove the last three of 686eb047 and place 2f0 after it.
    Go to cache and check tag = 686eb, set = 2f and offset = 0, cache hit.  And we get data value = 28.