# Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 13 (Page No. 255)

1 vote
112 views
If an instruction takes $1\: nsec$ and a page fault takes an additional $n\: nsec,$ give a formula for the effective instruction time if page faults occur every $k$ instructions.

$\underline{\textbf{Answer:}\Rightarrow}$

$\underline{\textbf{Explanation:}\Rightarrow}$

Assume $\mathbf k$ instructions:

$\mathbf{k-1}$ instructions execution without page fault $= 1 \times (\mathrm k-1) \;\text{nsec}$

$1$ instruction with page fault $= (1+n) \times 1\;\text{nsec}$

$\therefore$ Average is given by the formula $= {(1\times (\mathrm k-1) + 10 +n) \times 1)}{k}\; \mathbf{ =1 + \dfrac{n}{k} \;\text{nsec}}$

edited by
1
It should be 1 instead of 10... i think.
1
0
0

Thanks

Assume k instructions:

k−1 instructions execution without page fault =(k−1)nsec

1 instruction with page fault =(1+n)nsec

∴Average is given by the formula =(k−1+1+n) / k=1+n/nsec

## Related questions

1
79 views
Write a program that simulates a toy paging system that uses the $\text{WSClock}$ algorithm. The system is a toy in that we will assume there are no write references (not very realistic), and process termination and creation are ignored (eternal life). The ... per $1000$ memory references. Explain what is needed to extend the program to handle a page reference stream that also includes writes.
Write a program that simulates a paging system using the aging algorithm. The number of page frames is a parameter. The sequence of page references should be read from a file. For a given input file, plot the number of page faults per $1000$ memory references as a function of the number of page frames available.
We consider a program which has the two segments shown below consisting of instructions in segment $0,$ and read/write data in segment $1.$ Segment $0$ has read/execute protection, and segment $1$ has just read/write protection. The memory system is a demand- paged virtual memory system ... $16$ Fetch from segment $1,$ page $4,$ offset $28$ Jump to location in segment $1,$ page $3,$ offset $32$
A machine-language instruction to load a $32-bit$ word into a register contains the $32-bit$ address of the word to be loaded. What is the maximum number of page faults this instruction can cause?