Project #3 ::
Memory Management (Paging)
Structure of Trace Files
CIS343
Overview
You
may recall the following from our discussion of the structure of the trace
files which form the input for Project #3.
w Negative
Numbers - the
instruction counter
w Instruction
Execution information -
v Found between the negative
numbers
v Contains account of all
memory references and system calls
v Each individual action
X Is represented by a pair
X First item of the pair - the action code
Y 0 - a read from memory
Y 1000 - a write to memory
Y 500 - a system call
X Second item of the pair - either the memory location
or the system service
requested
Y If first # is
0 or 10000 -
the logical memory address
Y If first # is
500 - the
system service requested
w Important
Note - since
Syscall #3 involves writing a message to the screen, the
interrupt handler has to go to the
designated memory area of the process to obtain
the actual message, stored as ASCII
values.
w A
Second Note -
it is recommended that you edit each trace file and place the
number of instructions executed as the
first data item of that file.
v Example
- at the end of
the Fact-5 trace file you find:
-109
0 6
-110
0
34
X Since the last negative number is -110, that tells us that during
the course
of the Factorial program with an input of 5, 110 instructions were
executed.
X So place 110 as the first data item of
the Fact-5 trace file. Thus, the first
lines of that file should now look like this:
110
-1
0
0
-2
0
1
Line by
Line Commentary
Below are the first several lines of the Fact-5
execution trace (in Courier
font) with comments interspersed (in Times New Roman font).
110
The number of instructions executed by
this process
-1
Instruction #1
0
0
Read from memory location #0
-2
Instruction #2
0
1
Read from memory location #1
-3
Instruction #3
0
2
Read from memory location #2
500
3
System call #3 - this involves writing
a character string to the screen; therefore
a succession of memory reads is
necessary to obtain the ASCII values of the
characters to be sent to the screen.
0
49
Read from memory location #49; below
is a succession of reads from
memory locations #50 through #64
0
50
0
51
0
52
0
53
0
54
0
55
0
56
0
57
0
58
0
59
0
60
0
61
0
62
0
63
0
64
-4
Instruction #4
0
3
Read from memory location #3
-5
Instruction #5
0 4
Read from memory location #4
500
1
System call #1
-6
Instruction #6
0
5
Read from memory location #5
-7
Instruction #7
0
6
Read from memory location #6
-8
Instruction #8
0
7
Read from memory location #7
-9
Instruction #9
0
8
Read from memory location #8
-10
Instruction #10
0
9
Read from memory location #9
10000
9999
Write to memory location #9999 (this
represents a push onto the system stack)
-11
Instruction #11
0
10
Read from memory location #10
-12
Instruction #12
0
35
Read from memory location #35 (Notice
that a JSR occurred here)
-13
Instruction #13
0
36
Read from memory location #36
-14
Instruction #14
0
37
Read from memory location #37
-15
Instruction #15
0
38
Read from memory location #38
10000
9998
Write to memory location #9998
-16
Instruction #16
0
39
Read from memory location #39
A Final
Word
The
code template I have posted contains the complete code for reading the traces
and placing the information into parallel arrays which can be used for running
the simulation. Even if you do not
program in Visual Basic, you can treat that example as pseudo-code and
translate it into your favorite programming language.