Next Previous Contents
The Toy Memory Manager is a flexible C-based loader and parser built as a
CS330 project. It simulates a block of main memory and parses a file containing
a list of commands.
Basic syntax for the command file is:
P0 COMMAND [PARAMETER1 PAREMETER2 ...]
where P0 is the requested process, COMMAND is the requested command, and
PARAMETER 1 on are more parameters for the command. Some command do
not take any more parameters.
P0 is considered to be the 'operating system' thead, and as such is considered
already occupied. It also has access to priveleged commands that other
processes do not.
Toy Memory Manager currently only supports 10 processes; P0 through
P9 inclusive. This can easily be changed to a higher(or lower) number.
1.01 Parameter Types
Let us take an example line, and break it down:
P0 LoadFile @100 "FirstFile.lod
P0 is a Process ID - P<integer>, denotes which process the command
will be performed on.
LoadFile is a command - a strict case-sensitive string recognized by the
parser as a command.
@100 - @<integer> - is an address, denoting an area in the Toy Memory
Manager's physical memory.
"FirstFile.lod is a string; the " denotes the start of the string,
terminated by a newline. Because of this property, a string is always
the last parameter.
Other types
#100 - integers
@H5 - Relative heap addres
@S5 - Relative stack address
@D5 - Relative data address
@C5 - Relative code address
1.02 Basic Commands
The Toy Memory Manager supports a group of basic commands for the command
input files. These are:
LoadFile ADDRESS STRING
Processes a .lod file
PrintProcessTable
PrintProcessMemory
STORE
TerminateProcess
PrintAllMemory
END
AllocateHeap
ReallocateHeap
FreeHeap
PrintProcessHeap
v0.0.1:
-support all phase 1 commands
-Extra feature: Multiple file parsing, and extra command
v0.0.2:
-Added full support for all heap commands
-Now only allows read/write in allocated heap, instead of from any place
in heap
-Fixed memory leaks
-Fixed extra space after printing commands
-Added more generic and robust syntax checking via CheckLineSyntax
-Fixed compilation/linking problems with g++, cc, TC++, and CC
Next Previous Contents