Uploaded by Aphie.shinga

CSI22M1 Optional Test Solutions 100 Mark

advertisement
CSI22M1 Optional Test Solutions
100 Marks
1. Apply LFU to the reference string 701 203 042 303 212 if three frames of
memory are available.
[40 Marks]
Solution (F is for Fault and  is for a hit)
7
7
0
7
0
F
F
1
7
0
1
F
2
2
0
1
F
0
2
0
1

3
2
0
3
F
0
2
0
3

4
4
0
3
F
2
4
0
2
F
3
3
0
2
F
0
3
0
2

3
3
0
2

2
3
0
2

1
3
0
1
F
2
3
0
2
F
Frequency Table of page references by processes
When frequencies are the same, FIFO is used to decide the page to replace.
Each page has a frequency of zero initially.
If a page is referenced by a process, we cancel the previous frequency and increase it with 1.
If a page is replaced using LFU, three things happen:
i)
We increase the frequency of the incoming page
ii)
We reset the reference of the cancelled page
iii)
We place an X on top of the cancelled page
Each column below reflect the changes happening in the same column in the frames in memory, if nothing
happens to the page, nothing happens to it, the frequency is maintained.
7
0
1
2
3
4
1
0
0
0
0
0
1
1
0
0
0
0
1
1
1
0
0
0
0
1
1
1
0
0
0
2
1
1
0
0
0
2
0
1
1
0
0
3
0
1
1
0
0
3
0
0
1
1
0
3
0
1
0
1
0
3
0
1
1
0
0
4
0
1
1
0
0
4
0
1
2
0
0
4
0
2
2
0
0
4
1
0
2
0
0
4
2
1
0
0
2. Given the following jobs and that the system does 70% I/O wait, analyse CPU
utilization and determine when the jobs will finish executing compare this
time to when there is no multiprogramming, Show all detailed working and
draw relevant tables with values.
Solution
CPU idle
CPU busy
CPU/#processes
Number of
1
2
0.7 0.49
0.3 0.51
0.3 0.26
Processes
3
4
0.34 0.24
0.66 0.76
0.22 0.19
1. 0.3x10=3 mins, job number 1 is left with only 1 mins to complete but job
2 joins at 10 mins.
2. 0.51xy1=2 mins  y1=2 mins/0.51 =3.9 mins. Giving 13.9 mins mark.
Job number 1 is complete.
3. 0.3x1.1 =0.33 mins to reach the 15 mins mark
4. 5 minsx0.51=2.55/2=1.28 mins to reach the 20 mins mark.
5. So job number 2 is left with 0.39 mins to complete, job number 3 is left
with 2mins-1.28 = 0.72 mins to complete, so we go for 0.39 mins to
complete the shortest job about to finish. Calculating for 0.39 mins will
complete job
y3x0.66=0.39 mins for 3 jobs  y3=1.17/0.66 gives y3=1.77
So this takes us to 21.77 mins mark.
6. Job 3 is now left with 1.28 mins +0.39 mins =1.67 mins.
2mins – 1.67 mins =0.33 mins
Thus y4=0.66/0.51 =1.29 mins giving us 23.06 mins mark.
7. Job 4 is 0.39+0.33=0.72
2mins – 0.72mins 1.28 mins
So y5x0.3 = 1.28 mins
Y5=1.28 mins/0.3 = 4.27 mins. Giving us the 27.33 mins mark.
The time to finish if the system did not multiprogramming would be
(4+3+2+2)/0.3 = 36.67
If no multiprogramming was done then, it would have taken
(4+3+2+2) mins/0.3 = 36.67 mins instead of just 27.33 mins
3. Given the following system below, what is the physical address of virtual
memory address 16390.
Solution
We simply convert the address to binary format by writing a number line of
binary number values.
32768
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
Above we notice that 16390 is 16384+6 and therefore will fit as follows:
32768
16384
1
8192
4096
2048
1024
512
256
128
64
32
16
8
4
1
2
1
1
2048
0
1024
0
512
0
256
0
128
0
64
0
32
0
16
0
8
0
4
1
2
1
1
0
0
0
0
0
0
1
1
0
0
0
1
1
0
The rest will fill will zeros:
32768
0
0
16384
1
8192
0
0
1
0
1
0
0
Page index
4096
0
0
0
0
0
0
0
0
0
0
0
0
Offset
Coincidentally, the page index is the same as the frame number mapped and
therefore the physical address is also 16390.
0
Download