Design
Design
Introduction:
virtual machine which will accept programs in the target machine level language.
Project Description:
SIMMAC is a machine that will accept only a specific machine level language. It
contains a 512 bit words of memory, few registers, ALU for performing arithmetic
operations and each instruction contains an operand and an opcode. SIMMAC machine
language contains instructions with opcode and operands. Opcode such as ADD, SUB,
LDA, STR, BRH, CBR and LDI are supported and operand will hold either the value or
address of the opcode. SIMMAC should execute parallel programs in a round robin
Memory allocation: Each instruction is stored in a char array named mem[][]. For each
PCB struct: A Process Control Block data structure is maintained by the operating systems
for every process to keep a track of all the information of a process. To support parallel
execution of SIMMAC programs, round robin method is used which will execute the
instruction for a specific time limit. If the complete program is not executed in this
specific time, to again start the execution of the program from where it has stopped, the
PCB_Linkedlist struct: This is a structure of linked list where each node represents a PCB
structure. A single PCB_Linkedlist node is created for each program therefore this will
Approach:
When the user enters the input which can be a single file or multiple files with time
quantum, for each file a PCB_queue node is created and each instruction is loaded
This loop continues till all the files are loaded into the memory.
Once all the programs are loaded into the memory, the instructions are fetched from
These instructions are decoded which means that the opcode and operands are
determined.
As the programs are executed in round robin method each one will be executed only
for a specific time frame. If the complete program is not executed in that specific
time, the current register values are stored in PCB, so that program will resume from
Once the complete program is executed, the memory is cleared for all the instruction
in that program and the program is removed from the memory to create space for
other programs.
Flow Diagram:
Start
false True
If inputs Create PCB and allocate memory
are valid (main memory) for instructions.
If number of false
files to load
=0
True
If PSIAR = 0
Clear the memory for instruction. If time out
If PSIAR != 0
Remove the program from
memory. Save PCB with current register
values.
End