Programming- Process State Simulation

Assignment 02: Process State Simulation

CSci 430: Introduction to Operating Systems Fall 2020

In this assignment we will simulate a three-state process model (ready, running and blocked) and a simple process control block structure as introduced in Chapter 3 of our textbook. This simulation will utilize a ready queue and a list of blocked processes. We will simulate processes being created, deleted, timing out because they exceed their time quantum, and becoming blocked and unblocked because of (simulated) I/O events.

Questions

How does round robin scheduling work?
How does an operating system manage processes, move them between ready, running and blocked states, and
determine which process is scheduled next?
What is the purpose of the process control block? How does the PCB help an operating system manage and
keep track of processes?
Objectives
• Explore the Process state models from an implementation point of view.
• Practice using basic queue data types and implementing in C.
• Use C/C++ data structures to implement a process control block and round robin scheduling queues. • Learn about Process switching and multiprogramming concepts.
• Practice using STL queues and list data structures.
Introduction
In this assignment you will simulate a three-state process model (ready, running and blocked) and a simple list of processes, like the process control block structure as discussed in Chapter 3. Your program will read input and directives from a file. The input describes events that occur to the processes running in the simulation. These are the full set of events that can happen to and about processes in this simulation:

page1image51393856page1image51394048page1image51387136

In addition to these events, there are 2 other implicit events that need to occur before and after every simulated event 1

listed above.

page2image51475008

Action dispatch

timeout

Description

Before processing each event, if the CPU is currently idle, try and dispatch a process from the ready queue. If the ready queue is not empty, we will remove the process from the head of the ready queue and allocate it the CPU to run for 1 system time slice quantum.

After processing each event, we need to test if the running process has exceeded its time slice quantum yet. If a process is currently allocated to the CPU and running, check how long it has been run on its current dispatch. If it has exceeded its time slice quantum, the process should be timed out. It will be put back into a ready state, and will be pushed back to the end of the system ready queue.

page2image51552704page2image51559232

The input file used for system tests and simulations will be a list of events that occur in the system, in the order they are to occur. For example, the first system test file looks like this:

—– process-events-01.sim ——– new
cpu
cpu


Choose The Best Assignments Expert who have done on a similar assignment

"Do you have an upcoming essay or assignment due?


Get any topic done in as little as 6 hours

If yes Order Similar Paper

All of our assignments are originally produced, unique, and free of plagiarism.