Project #3 ::
Memory Management (Paging)
Trace of modClock
Do Not Print This - it is over 16 pages long!
CIS343
Caveat
(1) Although every effort has been made to ensure that the information below is correct, it has not yet been “battle tested”. Until it has been thoroughly tested, keep in mind that the program on which the numbers are based has errors, in which case the numbers would be incorrect.
(2) It is possible for two equally valid implementations to differ in frame assignment, thus leading to differences in the operation of modClock. We will discuss this in class.
Due to the size of the output, only the first portion of this file is posted.
Below is a trace of the operation of the modClock page replacement algorithm. It shows the state of the Frame Table at the time modClock is invoked and the changes it undergoes as Step #1 and Step#2 are carried out. The "pointer" referred to is the pointer which runs around the frame set. I have worked through this by hand and (assuming the state of the frame table is correct, as given) verified that the algorithm made the correct choice. You may wish to add the code given immediately below to your program as a useful debugging tool.
Public Sub printFrameTable()
Dim i As Integer
Print #showModClock, "Frame Info is:"
Print #showModClock, "Frame#", "Belongs to", "Page #", "Refbit", "Modbit"
For i = 0 To numFrames - 1
Print #showModClock, i, frameTable(i).jobID,
frameTable(i).pageNumber,
toBit(frameTable(i).refBit), toBit(frameTable(i).modBit)
Next i
End Sub
.
FIFO
Memory Size = 300
Page Size = 20
modClock invoked by Job# 1 at 607 - pointer is 0
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 0 1 0
1 2 0 1 0
2 3 0 1 0
3 4 0 1 0
4 5 0 1 0
5 1 2 1 0
6 1 3 1 0
7 2 1 1 0
8 2 2 1 0
9 3 2 1 0
10 3 3 1 0
11 4 1 1 0
12 4 2 1 0
13 5 2 1 0
14 5 3 1 0
Step #2
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 0 0 0
1 2 0 0 0
2 3 0 0 0
3 4 0 0 0
4 5 0 0 0
5 1 2 0 0
6 1 3 0 0
7 2 1 0 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 0 0 0
1 2 0 0 0
2 3 0 0 0
3 4 0 0 0
4 5 0 0 0
5 1 2 0 0
6 1 3 0 0
7 2 1 0 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 0
modClock invoked by Job# 2 at 636 - pointer is 1
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 0
1 2 0 1 0
2 3 0 0 0
3 4 0 0 0
4 5 0 0 0
5 1 2 0 0
6 1 3 0 0
7 2 1 1 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 2
modClock invoked by Job# 3 at 643 - pointer is 3
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 0
1 2 0 1 0
2 2 3 1 0
3 4 0 0 0
4 5 0 0 0
5 1 2 0 0
6 1 3 0 0
7 2 1 1 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 3
modClock invoked by Job# 4 at 663 - pointer is 4
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 0
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 5 0 0 0
5 1 2 0 0
6 1 3 0 0
7 2 1 1 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 4
modClock invoked by Job# 5 at 683 - pointer is 5
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 0
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 1 2 0 0
6 1 3 0 0
7 2 1 1 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 5
modClock invoked by Job# 1 at 807 - pointer is 6
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 5 0 1 0
6 1 3 0 0
7 2 1 1 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 6
modClock invoked by Job# 3 at 1146 - pointer is 7
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 5 0 1 0
6 1 0 1 0
7 2 1 1 0
8 2 2 0 0
9 3 2 0 0
10 3 3 0 0
11 4 1 0 0
12 4 2 0 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 8
modClock invoked by Job# 5 at 48637 - pointer is 9
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 5 0 1 0
6 1 0 1 0
7 2 1 1 0
8 3 4 1 0
9 3 2 0 0
10 3 3 0 0
11 4 1 1 0
12 4 2 1 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 9
modClock invoked by Job# 2 at 48640 - pointer is 10
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 5 0 1 0
6 1 0 1 0
7 2 1 1 0
8 3 4 1 0
9 5 499 1 0
10 3 3 0 0
11 4 1 1 0
12 4 2 1 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 10
modClock invoked by Job# 1 at 48643 - pointer is 11
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 5 0 1 0
6 1 0 1 0
7 2 1 1 0
8 3 4 1 0
9 5 499 1 0
10 2 2 1 0
11 4 1 1 0
12 4 2 1 0
13 5 2 0 0
14 5 3 0 0
Frame chosen: 13
modClock invoked by Job# 3 at 48689 - pointer is 14
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 5 0 1 0
6 1 0 1 0
7 2 1 1 0
8 3 4 1 1
9 5 499 1 0
10 2 2 1 0
11 4 1 1 0
12 4 2 1 0
13 1 1 1 0
14 5 3 0 0
Frame chosen: 14
modClock invoked by Job# 5 at 48839 - pointer is 0
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 2 0 1 0
2 2 3 1 0
3 3 0 1 0
4 4 0 1 0
5 5 0 1 0
6 1 0 1 0
7 2 1 1 0
8 3 4 1 1
9 5 499 1 1
10 2 2 1 0
11 4 1 1 0
12 4 2 1 0
13 1 1 1 0
14 3 5 1 0
Step #2
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 0 1
1 2 0 0 0
2 2 3 0 0
3 3 0 0 0
4 4 0 0 0
5 5 0 0 0
6 1 0 0 0
7 2 1 0 0
8 3 4 0 1
9 5 499 0 1
10 2 2 0 0
11 4 1 0 0
12 4 2 0 0
13 1 1 0 0
14 3 5 0 0
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 0 1
1 2 0 0 0
2 2 3 0 0
3 3 0 0 0
4 4 0 0 0
5 5 0 0 0
6 1 0 0 0
7 2 1 0 0
8 3 4 0 1
9 5 499 0 1
10 2 2 0 0
11 4 1 0 0
12 4 2 0 0
13 1 1 0 0
14 3 5 0 0
Frame chosen: 1
modClock invoked by Job# 1 at 48848 - pointer is 2
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 5 1 1 0
2 2 3 0 0
3 3 0 0 0
4 4 0 0 0
5 5 0 0 0
6 1 0 0 0
7 2 1 0 0
8 3 4 0 1
9 5 499 0 1
10 2 2 0 0
11 4 1 0 0
12 4 2 0 0
13 1 1 1 0
14 3 5 0 0
Frame chosen: 2
modClock invoked by Job# 3 at 48949 - pointer is 3
Step #1
Frame Info is:
Frame# Belongs to Page # Refbit Modbit
0 1 499 1 1
1 5 1 1 0
2 1 2 1 0
3 3 0 1 0
4 4 0 0 0
5 5 0 0 0
6 1 0 0 0
7 2 1 0 0
8 3 4 0 1
9 5 499 0 1
10 2 2 0 0
11 4 1 0 0
12 4 2 0 0