Question: Language/Platform The project must be written in C, C++, or Java. If using C or C++, you must use a Unix fork to create processes

Language/Platform

The project must be written in C, C++, or Java.

If using C or C++, you must use a Unix fork to create processes and a Unix pipe for communication.

If using Java, you must use the Runtime exec method to create processes and streams for communication.

Your project will receive no credit if not using processes or if using threads instead of processes.

All code must run successfully on our cs1.utdallas.edu server or csgrads1.utdallas.edu server.

Any other method requires instructor approval.

Problem Overview

The project will simulate a simple computer system consisting of a CPU and Memory.

The CPU and Memory will be simulated by separate processes that communicate.

Memory will contain one program that the CPU will execute and then the simulation will end

Problem Details

CPU

It will have these registers: PC, SP, IR, AC, X, Y.

It will support the instructions shown on the next page of this document.

It will run the user program at address 0.

Instructions are fetched into the IR from memory. The operand can be fetched into a local variable.

Each instruction should be executed before the next instruction is fetched.

The user stack resides at the end of user memory and grows down toward address 0.

The system stack resides at the end of system memory and grows down toward address 0.

There is no hardware enforcement of stack size.

The program ends when the End instruction is executed. The 2 processes should end at that time.

The user program cannot access system memory (exits with error message).

Memory

It will consist of 2000 integer entries, 0-999 for the user program, 1000-1999 for system code.

It will support two operations:

read(address) - returns the value at the address

write(address, data) - writes the data to the address

Memory will initialize itself by reading a program file.

Timer

A timer will interrupt the processor after every X instructions, where X is a command-line parameter.

Interrupt processing

There are two forms of interrupts: the timer and a system call using the int instruction.

In both cases the CPU should enter kernel mode.

The stack pointer should be switched to the system stack.

SP and PC registers should be saved on the system stack. (The handler may save additional registers).

A timer interrupt should cause execution at address 1000.

The int instruction should cause execution at address 1500.

Interrupts should be disabled during interrupt processing to avoid nested execution.

The iret instruction returns from an interrupt.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!