Consider a system with a two-level paging scheme in which a regular memory…

2004

Consider a system with a two-level paging scheme in which a regular memory access takes 150 nanoseconds, and servicing a page fault takes 8 milliseconds. An average instruction takes 100 nanoseconds of CPU time, and two memory accesses. The TLB hit ratio is 90%, and the page fault rate is one in every 10,000 instructions. What is the effective average instruction execution time?

  1. A.

    645 nanoseconds

  2. B.

    1050 nanoseconds

  3. C.

    1215 nanoseconds

  4. D.

    1260 nanoseconds

Attempted by 60 students.

Show answer & explanation

Correct answer: D

Step 1 — average memory access time including TLB misses: On a TLB hit (90%) a memory access costs 150 ns. On a TLB miss (10%) a two-level page table requires two extra memory reads plus the actual access (3 accesses total) = 3 * 150 = 450 ns. Therefore average memory access = 0.9 * 150 + 0.1 * 450 = 180 ns.

  • Two memory accesses per instruction: 2 * 180 ns = 360 ns.

  • Add CPU time per instruction: 100 ns. Subtotal without page faults = 360 + 100 = 460 ns.

  • Page-fault overhead: 8 ms = 8,000,000 ns. Page-fault rate = 1/10,000 = 0.0001 per instruction. Expected page-fault cost per instruction = 0.0001 * 8,000,000 ns = 800 ns.

  • Total effective instruction time = 460 ns + 800 ns = 1260 ns.

Answer: 1260 nanoseconds.

Explore the full course: Gate Guidance By Sanchit Sir