Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop the RR Algorithm in C. For the Round Robin scheduling algorithm, read the number of processes in the system, their CPU burst times, and

Develop the RR Algorithm in C.

For the Round Robin scheduling algorithm, read the number of processes in the system, their CPU burst times, and the size of the time slice. Time slices are assigned to each process in equal portions and in circular order, handling all processes execution. This allows every process to get an equal chance. Calculate the waiting time and turnaround time of each of the processes accordingly. Calculate average waiting time and average turnaround time. Add enough comments to explain what the code does.

We will make the following assumptions about the processes, sometimes called jobs, that are running in the system: 1. Each job runs during its allocated time slice round. 2. All jobs arrive at the same time. 3. Once started, each job runs to completion (i.e., not terminated before completion). 4. All jobs only use the CPU resource (i.e., they perform no I/O) 5. The run-time (burst time) of each job is known.

// CPU Scheduling Method: Round Robin (RR)

#include

int main () { int i = 0, j = 0, numProcesses= 0, timeSlice = 0, maxBurstTime = 0, temp = 0; int burstTime[10], backupBurstTime[10], waitTime[10], turnAroundTime[10], responseTime[10]; float avgWaitTime = 0.0, avgTurnAroundTime = 0.0, avgResponseTime = 0.0; printf("\t CPU Scheduling Method: Round Robin "); printf(" \t Enter the no of processes: "); scanf("%d", &numProcesses); for (i = 0; i

Sample output:

image text in transcribed

CPU Scheduling Method: Round Robin (RR) Enter the no of processes: 3 Enter Burst Time for process 1: 35 Enter Burst Time for process 2: 16 Enter Burst Time for process 3: 25 Enter the size of time slice: 5 RESPONSE TIME PROCESS P1 P2 P3 BURST TIME 35 16 25 WAITING TIME 41 35 41 TURNAROUND TIME 76 51 66 5 10 The Average Waiting time: 39.00 The Average Turnaround time: 64.33 The Average Response time: 5.00

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 Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions