Question
Our CPU is currently idle and the current time is labeled time 0. Four processes arrive to the ready queue at the following times and
Our CPU is currently idle and the current time is labeled time 0. Four processes arrive to the ready queue at the following times and with the following required run time:
Process--Arrival Time--Run Time
A-- 0 -- 10
B-- 1-- 29
C-- 2 -- 8
D-- 3 -- 4
Write a program that simulates the process scheduling and execution under the FCFS, SJF, and SRTN scheduling algorithms. Indicate each scheduling decision, and calculate the turnaround time for each process. Also calculate the average turnaround time for each scheduling algorithm. A (rough) sample solution for FCFS is given below to give an idea of the format for your answer:
FCFS:
At time 0, proc A arrives and is scheduled to run since the queue is empty
At time 1, proc B arrives but is put on the queue [B] since A is running
At time 2, proc C arrives but is put on the queue [B,C]
At time 3, proc D arrives but is put on the queue [B,C,D]
At time 10, proc A completes (turnaround is 10), and proc B starts [C,D]
etc.
Note that the ready queue is given in brackets [ ] after each step. Also note that you only need to specify points of interest. I didnt say, at time 4 process A continues to run, at time 5 process A continues to run, etc. Dont forget to indicate the turnaround time for each process and the average turnaround time for each algorithm.
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