0% found this document useful (0 votes)
101 views3 pages

SIMMAC Virtual Machine Design Document

This document outlines the design and implementation of SIMMAC, a virtual machine that executes programs in machine language. SIMMAC contains 512-bit words of memory, registers, and an ALU. It supports instructions like ADD, SUB, LDA, and more. Programs will be executed in parallel using a round robin technique with a user-specified time quantum. Memory is allocated for each instruction and a PCB struct tracks register values when a program's time expires so execution can resume. Instructions are loaded from files into memory arrays, fetched from memory, decoded, and executed in this round robin fashion until all programs complete or the time quantum is reached.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views3 pages

SIMMAC Virtual Machine Design Document

This document outlines the design and implementation of SIMMAC, a virtual machine that executes programs in machine language. SIMMAC contains 512-bit words of memory, registers, and an ALU. It supports instructions like ADD, SUB, LDA, and more. Programs will be executed in parallel using a round robin technique with a user-specified time quantum. Memory is allocated for each instruction and a PCB struct tracks register values when a program's time expires so execution can resume. Instructions are loaded from files into memory arrays, fetched from memory, decoded, and executed in this round robin fashion until all programs complete or the time quantum is reached.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DESIGN DOCUMENT

Introduction:

This document explains the detail design and implementation of SIMMAC, a

virtual machine which will accept programs in the target machine level language.

SIMMAC is implemented using C 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

technique where the time quantum is specified as an input.

Implementation and Design:

Memory allocation: Each instruction is stored in a char array named mem[][]. For each

node a specific amount of memory is created which is equal to length of node.

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

register values are stored in this PCB node.

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

keep a track of number of programs.

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

into a memory in an array format(mem[][]).

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

the main memory and stored in instruction register(IR).

These instructions are decoded which means that the opcode and operands are

determined.

After that the instructions are executed.

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

the last instruction.

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

Inputs are given from command line


which are time quantum and text files.

false True
If inputs Create PCB and allocate memory
are valid (main memory) for instructions.

If number of false
files to load
=0

True

Fetch, decode and execute the


instructions

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

Common questions

Powered by AI

Supporting multiple input files from the command line, each with its own time quantum, is significant for SIMMAC as it allows the system to handle diverse program workloads simultaneously. This capability ensures that each program can be independently executed within its specified execution time, accommodating various processing requirements and improving overall system flexibility and responsiveness to different user needs .

The instruction register (IR) in the SIMMAC execution process is pivotal as it temporarily holds the current instruction fetched from memory. This enables the system to decode the instruction by identifying the opcode and operands. By storing the instruction in the IR, the machine can execute it effectively by breaking it down into actionable parts, which are then processed by the Arithmetic Logic Unit (ALU).

The Process Control Block (PCB) in the SIMMAC system is crucial for managing the execution of programs. It stores all necessary information to resume a program's execution. This includes current register values, which are recorded if a program's execution is interrupted due to the time limit in the round robin scheduling method. By maintaining this data in a PCB, SIMMAC can pause and later resume programs without loss of state, thereby supporting the parallel execution capabilities of the machine .

The PCB_Linkedlist in SIMMAC is structured as a linked list where each node corresponds to a PCB structure. This organization allows for efficient tracking and management of multiple programs as each node can store the process information and state of a program. As programs are executed and potentially paused, the linked list facilitates the management and retrieval of each program's state, enabling effective process scheduling and resource allocation .

The SIMMAC system uses the PCB (Process Control Block) to resume a program's execution after an interruption. When a program is halted due to the completion of its time quantum, the PCB stores the current register values. Upon resumption, these stored values allow the program to continue from the exact point of interruption, ensuring continuity and state preservation. This is crucial for the round robin scheduling, which requires programs to be paused and resumed repeatedly .

After a program's execution in SIMMAC, the system clears memory by removing the instructions for that program from the mem[][] array. This deallocates resources, ensuring memory is available for other programs, thus improving system efficiency by preventing memory bloat and ensuring optimal use of memory resources for concurrent program execution .

SIMMAC ensures fair execution of programs by implementing the round robin scheduling technique, where each program receives a time quantum, allowing all programs to execute in turn. When system resources are limited, this approach prevents any single program from starving resources by allocating time slices to all active programs in a cyclic order. This method achieves balanced CPU time distribution without favoritism, ensuring all programs progress towards completion .

The SIMMAC virtual machine employs the round robin technique to execute parallel programs by allocating each program a time quantum, a fixed time period for execution before moving to the next. This scheduling method is significant for parallel execution, as it ensures that each program gets CPU time in a cyclic order. This prevents any single program from monopolizing the CPU, enabling fair and efficient multi-program execution in constrained system resources .

The SIMMAC machine language supports several opcodes including ADD, SUB, LDA, STR, BRH, CBR, and LDI. Each instruction consists of an opcode and an operand. The operand functions alongside the opcode to either specify a value or address which determines the operation or data to be processed by the opcode. For example, the ADD opcode adds the value specified by the operand to a register .

SIMMAC allocates memory for instructions by storing each instruction in a character array named mem[][], with each element of the array representing an instruction node. This allows the system to manage multiple instructions loaded into memory simultaneously. For each program, a PCB_queue node is created to track its instructions, which are loaded into this memory array for execution .

You might also like