Question: Your task is to read in the events, and simulate the creation and execution of processes in the system as they move through the various
Your task is to read in the events, and simulate the creation and execution of processes in the system as they move through the various three-states of their process life cycle. You need to:
- Ready queue of some kind. You can use a simple C array to hold your queue, though you will need to implement some simple queuing functions in that case. You may also use the C++ Standard Template Library (STL) vector and/or queue data structures to implement your queues.
-Implement a simple dispatcher function. Whenever a cpu event occurs, and no process is currently running, you should select the next Ready process from your ready queue and start it running on the processor.
-You need to also implement a simple time slicing mechanism. The time slice value to use will be passed into your program when it is started. At the end of a cpu cycle, you should check if the currently running process has executed for its full time quantum. In that case, the currently running process should timeout, and be returned to the end of the Ready queue.
Note: A starting template is provided. The code will parse the required command line arguments, open up the specified input file, and then read in the simulation commands from the input file. In the runSimulation() method in the templates is the main loop where the input file is opened and read line by line. The template doesn't actually do anything, you need to add code to simulate a cpu cycle, a new process being created, a process being blocked and waiting on some event, etc. The result should look like the .res file included. The input file (.sim) will simply be a list of events that occur in the system, in the order they are to occur.
Files:
Template: https://drive.google.com/file/d/1pgySTTnBpM6KNpT5iywxbOYFApp2P3El/view?usp=sharing
.res file: https://drive.google.com/file/d/1jk2-otqIPAOOI7ile_WetSHOcb6iv2jR/view?usp=sharing
.sim file: https://drive.google.com/file/d/11TVNh7qQtSfBo1wPaJGk0HZYFsnrSKFQ/view?usp=sharing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
