Question: The assignment, you are required to simulate the corresponding functions of a real operating system. The main goal of this part of the assignment is

The assignment, you are required to simulate the corresponding functions of a real operating system. The main goal of this part of the assignment is not to create a program that can simply produce output, such as response time and completion time for a set of processes and a scheduling algorithm, but to correctly and accurately implement the essential scheduling functions as they are implemented in a real operating system. For example, you should follow the instructions below:
The scheduling algorithms should be implemented in separate program sections (C modules with correspondinghowever minimalfunctions).
For each scheduling algorithm, you should define and declare in separate "header files" the structures and functions that will support its operation (queues, stacks, etc.).
Implement a visible, separate "ready queue" where processes will enter (according to each algorithm) before they are scheduled on the CPU.
Each algorithm should take as input (a) the arrival time unit, (b) the CPU time required (in time units) for each process, and (c) the priority for each new process. It will then make decisions on the order in which it will execute each process based on whether the algorithm is preemptive and according to its principles. For example, if it is preemptive, it will make decisions both when a new process arrives and when an event causes a blocked process to transition to the ready or running state.
After a specified number of steps, the program should produce as output the initial format shown in Part A of the Assignment (Gantt chart), but only for itself. For instance, the following is an example of output for the Preemptive Priority (PP) algorithm:
Time : 013456...20
PP : P0 P1... P5
Implement a virtual CPU and a virtual process usage procedure for the CPU by a process (e.g., a function that simply "returns" an appropriate value).
Represent each process similarly to how it would be in a real operating system (a structure with various fields, PCB, etc.). This structure should be updated by the scheduling algorithm at each status change, saving the state of the process in the corresponding structure. When the process transitions from the running to the ready state, the Program Counter and Stack Pointer should be saved, and the amount of time the process has run so far should be updated.
Although the arrival time and number of processes in the system are known, try to simulate their "dynamic" entry into the system (e.g., using a counter, loop, state array, and operation execution for each time unit, etc.). This means that each time unit should be simulated independently, and everything necessary should be executed dynamically for that duration.
Implement a "process creation" function for the system (initializing PCB, etc.) and a separate "process termination" function.
Finally, your code should be as compact as possible and should include sufficient comments and documentation.
To verify the correctness of your program, initially try the following:Create suitable examples of your own, which should:
Demonstrate the advantages and disadvantages of each of the four mentioned scheduling algorithms. You should create and run a total of eight (8) such examples (two for each algorithm). Comment on the results for each algorithm separately.
Show a comparative analysis of the advantages and disadvantages for three of the four given scheduling algorithms (excluding the "Preemptive Priority" algorithm) by comparing them in pairs.
Additionally, create two or three examples in which a process, using one of the given scheduling algorithms of your choice, is forced to wait for a significantly longer time (relative to the time it actually needs) to complete its execution (starvation).Thank you for your help

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 Programming Questions!