GATE / CS ARCHIVE

GATE CSE 1992 / QUESTION 12(b)

Working-set faults and average frames

Operating Systems · Virtual Memory & Paging · Full GATE CSE 1992 paper

GATE 1992, Q12(b) Descriptive
Report issue

Virtual Memory & Paging

Question 12(b), GATE 1992: With working-set window Δ=4, process the page references c c d b c e c e a d. Initially W(0)={a,d,e}; the latest initial references are a at t=0, d at t=−1, and e at t=−2. Find each working set, the total faults, and average frames used.
Tap to enlarge
Answer & solution

Answer: 5 page faults; average |W(t)| for t=1…10 is 3.2 frames. (no official key was published)

Use the standard discrete-reference window W(t) containing pages referenced at times t−3 through t, i.e. the last four references including the current one. Immediately before reference t, resident pages are W(t−1); a fault occurs exactly when the requested page is absent there. After serving the request, remove pages no longer in the new window. The specified W(0) fixes initial residency; any unspecified t=−3 reference expires at t=1 and does not affect the trace.

t  page   W(t)       size  fault?
0  a      {a,d,e}     3    initial state
1  c      {a,c,d,e}   4    yes
2  c      {a,c,d}     3    no
3  d      {a,c,d}     3    no
4  b      {b,c,d}     3    yes
5  c      {b,c,d}     3    no
6  e      {b,c,d,e}   4    yes
7  c      {b,c,e}     3    no
8  e      {c,e}       2    no
9  a      {a,c,e}     3    yes
10 d      {a,c,d,e}   4    yes

For example at t=6 the four references are d,b,c,e, whereas at t=8 they are c,e,c,e, using only two distinct frames. The last d reference at t=3 has expired by t=7, so d faults again at t=10. Fault times are 1,4,6,9,10: five faults.

The frame sum over the ten requested-reference instants is 4+3+3+3+3+4+3+2+3+4=32, so the conventional post-reference average is 32/10=3.2 frames. If one instead includes the supplied initial snapshot as an eleventh sample, the average is 35/11; if averaging pre-reference residency W(0)…W(9), it is 31/10. These are different sampling conventions, not different working-set traces. The reported 3.2 explicitly averages W(1)…W(10).

Original paper, page 8