Answer : 4
Exp :
Fetching lw : CPU has address, say A1, from where to fetch lw. We’ll look into page table, in worst case, page table may not be present in the memory as it is given in the question that “Page tables are not locked in memory and may be swapped to disk”. So, we bring page table. 1 page fault. Now, it could happen that the page containing lw word is not in memory, so we bring it, 1 page fault. So, fetch cycle, in worst case, may have 2 page faults.
Decoding lw : The data word that needs to be loaded has the address A2 which is sum of the value in a register and an immediate constant stored in the instruction lw itself. So, No page fault here.
Executing lw :
CPU has address, say A2, of the data word that needs to be loaded. We’ll look into page table, in worst case, page table may not be present in the memory as it is given in the question that “Page tables are not locked in memory and may be swapped to disk”. So, we bring page table. 1 page fault. Now, it could happen that the page containing the data word is not in memory, so we bring it, 1 page fault. So, execution cycle, in worst case, may have 2 page faults.
Total 4.