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.
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?
• 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.
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:
In addition to these events, there are 2 other implicit events that need to occur before and after every simulated event 1
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.
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