edited by
742 views
1 votes
1 votes

 A certain computer has a $TLB$ cache, a one-level physically-addressed data cache, $DRAM$, and a disk backing store for virtual memory. 
The processor loads the instruction below and then begins to execute it.

LW R3, 0(R4)   $[$ LW means Load Word $]$

This indicates that the computer should access the virtual address currently stored in register $4$ and load that address’s contents into register $3$.

Which of the following is true about what might happen while executing this instruction?

  1.    If a TLB miss occurs, then a page fault definitely occurs as well.
  2.    If a data cache miss occurs, then a page fault definitely occurs as well.
  3.    No more than one data cache miss can occur.
  4.    If a page fault occurs, then a data cache miss definitely does not occur as well. 
     
edited by

2 Answers

Best answer
4 votes
4 votes

The basic process starts with converting the virtual address to a physical address; if possible, this relies on the TLB cache’s stored entry that maps virtual address to physical address, but if this fails, then the page table must be consulted in physical or virtual memory. Once the physical address is available, the processor can attempt to retrieve the actual value from the data cache, but if this fails, then the value must be read from physical memory.


Option A

It is not true, 

Reason :  a TLB miss can occur without a subsequent page fault. The TLB is typically much smaller than physical memory. It is quite possible that a page’s virtual-to physical mapping will get forced out of the TLB without getting forced out of physical memory. So miss in TLB does not mean a page fault always.


Option B :

it is also not true,

Reason : a data cache miss can occur without a subsequent page fault. Like the TLB, the data cache is much smaller than the physical memory. It is quite possible that page content will get forced out of the cache without getting forced out of physical memory.


Option C :

It  is true,  

Reason : since virtual-to-physical address translation relies on checking the TLB cache rather than the data cache. Hence, the translation cannot generate a data cache fault. Although the ensuing load from the physical address can still generate a data cache miss, this still only have in total one data cache miss.

Option D :

It is False .

Reason : Because retrieving data from disk takes milliseconds ( long enough with repect to CPU ) , whereas retrieving data from cache takes microseconds, computers will never generate page faults until after unsuccessfully testing the cache. Hence, if a page fault occurs, then a cache miss must have been performed before that fault.

Hence it is clear from these options that correct choice is C .

2 votes
2 votes
A   If a TLB miss occurs, then a page fault definitely occurs as well.

B    If a data cache miss occurs, then a page fault definitely occurs as well.

C   No more than one data cache miss can occur.

D   If a page fault occurs, then a data cache miss definitely does not occur as well.

TLB miss has nothing to do with page fault. Its just that the page table entry is not in the TLB and can be fetched from page table in main memory

A data cache miss also doesnt imply page fault. Data can be present in main memory and not in cache memory.

If a page fault occurs, obviously cache miss must have occured before.

So only correct answer is C. We are loading a word from memory which can only result in one data cache. Obviously one instruction cache miss can also occur.
Answer:

Related questions