Answered step by step
Verified Expert Solution
Link Copied!

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:
1) Enter parameters
2) Schedule processes with FIFO algorithm
3) Schedule processes with SJF algorithm
4) Schedule processes with SRT algorithm
5) 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 [auto-generated, starting from 0do not
input the id from the user]
o arrival: the point in time i.e. when the process enters the ready list to be executed by the CPU [input from the user]
o total_cpu: the amount of CPU time the process will consume between arrival and
departure [input from the user]
o total_remaining: 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 (1) or not (0)
o start_time: the time when the process has begun being executed by the CPU
o already_started: a flag that indicated whether the process has already begun (1) or
not (0)[used for SRT scheduling only]
o end_time: the time when the process has been completed by the CPU
o turnaround_time: 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 start_time, end_time, and turnaround_time for each process based on the selected scheduling algorithm.
What NOT to do:
Do NOT modify the choice values (1,2,3,4,5) or input characters and then try to convert them to integers--the test script used for grading your assignment will not work correctly.
Sample output
Batch scheduling
----------------
1) Enter parameters
2) Schedule processes with FIFO algorithm
3) Schedule processes with SJF algorithm
4) Schedule processes with SRT algorithm
5) Quit and free memory
Enter selection: 1
Enter total number of processes: 3
Enter arrival cycle for process 0: 0
Enter total cycles for process 0: 6
Enter arrival cycle for process 1: 1
Enter total cycles for process 1: 3
Enter arrival cycle for process 2: 3
Enter total cycles for process 2: 2
PID Arrival Total Start End Turnaround
--------------------------------------------------
006
113
232
Batch scheduling
----------------
1) Enter parameters
2) Schedule processes with FIFO algorithm
3) Schedule processes with SJF algorithm
4) Schedule processes with SRT algorithm
5) Quit and free memory
Enter selection: 2
PID Arrival Total Start End Turnaround
--------------------------------------------------
006066
113698
2329118
Batch scheduling
----------------
1) Enter parameters
2) Schedule processes with FIFO algorithm
3) Schedule processes with SJF algorithm
4) Schedule processes with SRT algorithm
5) Quit and free memory
Enter selection: 3
PID Arrival Total Start End Turnaround
--------------------------------------------------
006066
11381110
232685
Batch scheduling
----------------
1) Enter parameters
2) Schedule processes with FIFO algorithm
3) Schedule processes with SJF algorithm
4) Schedule processes with SRT algorithm
5) Quit and free memory
Enter selection: 4
PID Arrival Total Start End Turnaround
--------------------------------------------------
00601111
113143
232463
Batch scheduling
----------------
1) Enter parameters
2) Schedule processes with FIFO algorithm
3) Schedule processes with SJF algorithm
4) Schedule processes with SRT algorithm
5) Quit and free memory
Enter selection: 5
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. Please make sure it compiles without any error and output is same as given sample output.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions