Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objective: To calculate the timing parameters of batch processes based on different scheduling algorithms by using C language. Specification: The program mimics the execution of
Objective:
To calculate the timing parameters of batch processes based on different scheduling algorithms by using C language.
Specification:
The program mimics the execution of different processes under different scheduling algorithms. The simulation maintains a table that reflects the current state of the system, based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are:
Enter parameters
Schedule processes with FIFO algorithm
Schedule processes with SJF algorithm
Schedule processes with SRT algorithm
Quit program and free memory
Assignment:
Create a table to record the status of different processes based on the following parameters:
o id: the unique identifier of the process autogenerated, starting from do not
input the id from the user
o arrival: the point in time ie when the process enters the ready list to be executed by the CPU input from the user
o totalcpu: the amount of CPU time the process will consume between arrival and
departure input from the user
o totalremaining: the amount of CPU time remaining for a process to complete used
for SRT scheduling only
o done: a flag that indicates whether the process has been successfully completed or not
o starttime: the time when the process has begun being executed by the CPU
o alreadystarted: a flag that indicated whether the process has already begun or
not used for SRT scheduling only
o endtime: the time when the process has been completed by the CPU
o turnaroundtime: the sum of the total CPU time and the waiting time alternatively:
the difference between the end time and the arrival time
Calculate the values for the starttime, endtime, and turnaroundtime for each process based on the selected scheduling algorithm.
What NOT to do:
Do NOT modify the choice values or input characters and then try to convert them to integersthe test script used for grading your assignment will not work correctly.
Sample output
Batch scheduling
Enter parameters
Schedule processes with FIFO algorithm
Schedule processes with SJF algorithm
Schedule processes with SRT algorithm
Quit and free memory
Enter selection:
Enter total number of processes:
Enter arrival cycle for process :
Enter total cycles for process :
Enter arrival cycle for process :
Enter total cycles for process :
Enter arrival cycle for process :
Enter total cycles for process :
PID Arrival Total Start End Turnaround
Batch scheduling
Enter parameters
Schedule processes with FIFO algorithm
Schedule processes with SJF algorithm
Schedule processes with SRT algorithm
Quit and free memory
Enter selection:
PID Arrival Total Start End Turnaround
Batch scheduling
Enter parameters
Schedule processes with FIFO algorithm
Schedule processes with SJF algorithm
Schedule processes with SRT algorithm
Quit and free memory
Enter selection:
PID Arrival Total Start End Turnaround
Batch scheduling
Enter parameters
Schedule processes with FIFO algorithm
Schedule processes with SJF algorithm
Schedule processes with SRT algorithm
Quit and free memory
Enter selection:
PID Arrival Total Start End Turnaround
Batch scheduling
Enter parameters
Schedule processes with FIFO algorithm
Schedule processes with SJF algorithm
Schedule processes with SRT algorithm
Quit and free memory
Enter selection:
Quitting program...
Please make sure it is giving the same output as given on the sample output portion of the question and only use C language.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started