0% found this document useful (0 votes)
3 views

OSY Micro-Project

Uploaded by

Swapnaja Kumbhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

OSY Micro-Project

Uploaded by

Swapnaja Kumbhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

A

Micro project report On

“Round Robin Algorithm”

SUBMITTED TO M.S.B.T.E.,
Mumbai

For the Award of


DIPLOMA IN COMPUTER ENGINEERING BY

Roll no Name of Student Enrollment no.

16 Tanishka Umesh Karande. 2210740175


34 Samiksha Annasaheb Bhosale 2210740194
36 Swapnaja Samir Kumbhar. 2210740196
62 Vaishnavi Santosh Chaudhari. 2210740385

UNDER THE GUIDANCE OF


Mrs. V. S. Wangikar
DEPARTMENT OF COMPUTER ENGINEERING

SVERI’s College of Engineering (Polytechnic), Gopalpur


Pandharpur-413304

2024-25

M.S.B.T.E.
Evolution sheet for Micro Project
Academic Year: - 2024-25 Name of Faculty: Mrs. V. S. Wangikar
Course: - Computer Engineering Course Code: - CO5I
Subject: - Operating System Subject Code: - 22516
Semester: - 5 Scheme: - I

Title of Project: - Round Robin Algorithm

Major Learning Outcomes achieved by students by doing the Project:

(a)Practical Outcomes:  Write a program to calculate total waiting and


turnaround time of n processes with Round Robin
algorithm.

(b) Unit Outcomes in  Apply round robin algorithm to calculate turnaround


Cognitive domain: time and average waiting time.

(c) Outcomes in Affective Domain: 1. Follow precautionary measures.


2. Follow naming conventions.
3. Follow ethical practices.
Comments/Suggestions about team work/leadership/inter-personal communication (if any)

Marks out of 4
Marks out of 6 for Total mars
for
performance in out of 10
Roll No Name of students performance in
group activity
oral/
Presentation
16 Tanishka Umesh Karande.
34 Samiksha Annasaheb Bhosale.
36 Swapnaja Samir Kumbhar.
62 Vaishnavi Santosh Chaudhari.

Guide Mrs. V. S. Wangikar


SVERI’s COLLEGE OF ENGINEERING (POLYTECHNIC), PANDHARPUR.

CERTIFICATE

This is to certify that the Project report entitled


Submitted by
“Round Robin Algorithm”

Roll no Name of Student Enrollment no

16 Tanishka Umesh Karande. 2210740175


34 Samiksha Annasaheb Bhosale. 2210740194
36 Swapnaja Samir Kumbhar. 2210740196
62 Vaishnavi Santosh Chaudhari. 2210740385

is a bonafide work carried out by above students, under the guidance of Mrs. V. S. Wangikar and
it is submitted towards the fulfillment of requirement of MSBTE, Mumbai for the award of
Diploma in Computer Engineering at SVERI’s COE (Polytechnic), Pandharpur during the
academic year 2024-25.

(Mrs. V. S. Wangikar)
Guide

(Mr. P. S. Bhandare) (Dr. N. D. Misal)


HOD Principal

Place: Pandharpur.

Date: / /
Acknowledgement

“Round Robin Algorithm” has been developed successfully with a great


contribution of four students in a period of two months. We like to appreciate their guidance,
encouragement and willingness since without their support the project would not have been a
success. We would like to give our heartfelt gratitude to Principal Dr. N. D. Misal, Guide
Mrs. V. S. Wangikar & HOD Mr. P. S. Bhandare who is the supervisor of our project for
helping and encouraging us in many ways to make our project a success. We would never
been able to finish our work without great support and enthusiasm from friends and support
from our family. We would like to thank the department of Computer Engineering, for giving
us permission to initiate this project and successfully finish it.
CPU Scheduling Algorithm:

1. First-Come, First-Served (FCFS):


It schedules processes in the order they arrive, where the first process to request the CPU gets it first. It’s
simple but inefficient as shorter processes may have to wait for long ones, leading to the convoy effect.
Advantages: Simple to implement and understand.
Disadvantages: Long waiting time for processes, especially if a large process arrives first (known as the
"convoy effect").

2. Shortest Job Next (SJN):


It is also known as Shortest Job First (SJF), selects the process with the shortest CPU burst time for
execution. It’s highly efficient in reducing average waiting time but can lead to starvation for longer
processes if shorter ones keep arriving.
Advantages: Minimizes average waiting time and turnaround time.
Disadvantages: Hard to predict the next CPU burst time. Can cause starvation for longer processes

3. Priority Scheduling :
It assigns each process a priority, and the CPU is allocated to the process with the highest priority. In its
preemptive form, it interrupts the current process if a higher-priority one arrives, but this can lead to
starvation for lower-priority tasks.
Advantages: Flexible as processes can have different priorities.
Disadvantages: Can cause starvation for lower-priority processes. Aging is a technique used to prevent
starvation by gradually increasing the priority of waiting processes.

4. Shortest Remaining Time:


It is a preemptive variant of SJN where the process with the shortest remaining burst time is always
selected next, preempting the current task if a shorter one arrives
Advantages: Minimizes average waiting and turnaround time by always selecting the process with the
shortest remaining time.
Disadvantages: Can lead to starvation for longer processes if shorter processes keep arriving.

5. Round Robin (RR):


It gives each process a fixed time quantum, cycling through processes in a circular queue. If a process
doesn’t complete within its time slice, it is sent to the back of the queue.

Advantages: Fair allocation of CPU time to all processes. Good for time-sharing systems
.Disadvantages: Performance depends on the size of the time quantum. If too small, there’s too much
overhead; if too large, it behaves like FCFS.

6. Multiple-Level Queues :
It categorize processes into different queues based on attributes like priority or process type, with each
queue having its own scheduling algorithm. However, this can cause starvation for processes in lower-
priority queues if higher-priority queues are always busy.
Advantages: Separation of processes based on their priority and type.
Disadvantages: Hard to manage; processes may suffer from starvation if lower-priority queues are
neglected.
Introduction:
A Process Scheduler schedules different processes to be assigned to the CPU based on particular
scheduling algorithms. There are six popular process scheduling algorithms in which we can do study about
Round Robin Algorithm.

 First-Come, First-Served (FCFS) Scheduling


 Shortest-Job-Next (SJN) Scheduling
 Priority Scheduling
 Shortest Remaining Time
 Round Robin(RR) Scheduling
 Multiple-Level Queues Scheduling

The Round robin scheduling algorithm is one of the CPU scheduling algorithms in which every process
gets a fixed amount of time quantum to execute the process.
In this algorithm, every process gets executed cyclically. This means that processes that have their burst
time remaining after the expiration of the time quantum are sent back to the ready state and wait for their
next turn to complete the execution until it terminates. This processing is done in FIFO order which
suggests that processes are executed on a first-come, first-serve basis.
Note: The CPU time quantum is the time period defined in the system.

Round Robin (RR):


The simplest pre-emptive scheduling algorithm is round-robin, in which the processes are given
turns at running, one after the other in a repeating sequence, and each one is pre-empted when it has used up
its time slice. So, for example, if we have three processes {A, B, C}, then the scheduler may run them in the
sequence A, B, C, A, B, C, A, and so on, until they are all finished.
Round-robin scheduling allocates each task an equal share of the CPU time. In its simplest form, tasks are in
a circular queue and when a task's allocated CPU time expires, the task is put to the end of the queue and the
new task is taken from the front of the queue.
There is a lot of popularity for this Round Robin CPU Scheduling is because Round Robin works only in
Pre Emotive state. This makes it very reliable.

Round Robin CPU Scheduling:


Round Robin CPU Scheduling is the most important CPU Scheduling Algorithm which is ever
used in the history of CPU Scheduling Algorithms. Round Robin CPU Scheduling uses Time Quantum
(TQ). The Time Quantum is something which is removed from the Burst Time and lets the chunk of process
to be completed.
Time Sharing is the main emphasis of the algorithm. Each step of this algorithm is carried out cyclically.
The system defines a specific time slice, known as a time quantum.

Working of Round Robin:

First, the processes which are eligible to enter the ready queue enter the ready queue. After entering
the first process in Ready Queue is executed for a Time Quantum chunk of time. After execution is
complete, the process is removed from the ready queue. Even now the process requires some time to
complete its execution, and then the process is added to Ready Queue.
The Ready Queue does not hold processes which already present in the Ready Queue. The Ready Queue is
designed in such a manner that it does not hold non unique processes. By holding same processes
Redundancy of the processes increases.

How does the Round Robin Algorithm Work?

1. All the processes are added to the ready queue.


2. At first, the burst time of every process is compared to the time quantum of the CPU.
3. If the burst time of the process is less than or equal to the time quantum in the round-robin
scheduling algorithm, the process is executed to its burst time.
4. If the burst time of the process is greater than the time quantum, the process is executed up to the
time quantum (TQ).
5. When the time quantum expires, it checks if the process is executed completely or not.
6. On completion, the process terminates. Otherwise, it goes back again to the ready state.

Consider the above flow diagram for a better understanding of Round Robin scheduling algorithm:
After, the process execution is complete, the Ready Queue does not take the completed process for holding.

Example:-

Consider the four process p1,p2,p3,p4 with length of CPU burst time. Find out average waiting time and
average turnarround time for the Round Robin algorithm with time Slice 4 ms.

Process Burst Time Arrival Time

P1 8 0
P2 4 1
P3 9 2
P4 5 3
Ans :

P1 P2 P3 P4 P1 P3 P4 P3

0 4 8 12 16 20 24 25 26
Waiting time : P1 = 16-4 = 12-0 = 12

P2 = 4-1 = 3

P3 = 25-8 = 17-2 = 15

P4 = 24-4 = 20-3 = 17

Total waiting time


Average Waiting time =
Number of processes

12 + 3 + 15 + 17 47
4 4
Average Waiting time = 11.75ms

Turn Around Time = P1 = 20-0 = 20

P2 = 8-1 = 7

P3 = 26-2 = 24

P4 = 25-3 = 22

Total turn around time


Turn Around Time =
Number of processes

20 + 7 + 24 + 22 73
=
4 4

Turn Around Time = 18.25ms


Example:-
import java.util.*;

public class RoundRobinScheduling {


public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Total number of processes in the system: ");


int NOP = scanner.nextInt();

int[] at = new int[NOP]; // Arrival times


int[] bt = new int[NOP]; // Burst times
int[] temp = new int[NOP]; // Temporary burst times for processing

for (int i = 0; i < NOP; i++) {


System.out.printf("\nEnter the Arrival and Burst time of the Process[%d]\n", i + 1);
System.out.print("Arrival time is: ");
at[i] = scanner.nextInt();
System.out.print("Burst time is: ");
bt[i] = scanner.nextInt();
temp[i] = bt[i];
}

System.out.print("Enter the Time Quantum for the process: ");


int quant = scanner.nextInt();

int sum = 0, count = 0, y = NOP, wt = 0, tat = 0;


float avg_wt, avg_tat;

System.out.println("\nProcess No\tBurst Time\tTAT\t\tWaiting Time");

int i = 0;
while (y != 0) {
if (temp[i] <= quant && temp[i] > 0) {
sum += temp[i];
temp[i] = 0;
count = 1;
} else if (temp[i] > 0) {
temp[i] -= quant;
sum += quant;
}

if (temp[i] == 0 && count == 1) {


y--;
int turnaroundTime = sum - at[i];
int waitingTime = turnaroundTime - bt[i];
wt += waitingTime;
tat += turnaroundTime;
System.out.printf("Process No[%d]\t%d\t\t%d\t\t%d%n", i + 1, bt[i], turnaroundTime,
waitingTime);
count = 0;
}
if (i == NOP - 1) {
i = 0;
} else if (at[i + 1] <= sum) {
i++;
} else {
i = 0;
}
}

avg_wt = (float) wt / NOP;


avg_tat = (float) tat / NOP;

System.out.printf("\nAverage Turn Around Time: \t%.6f%n", avg_tat);


System.out.printf("Average Waiting Time: \t\t%.6f%n", avg_wt);

scanner.close();
}
}

Output:-
Advantages:
The Advantages of Round Robin CPU Scheduling are:
1. A fair amount of CPU is allocated to each job.
2. Because it doesn't depend on the burst time, it can truly be implemented in the system.
3. It is not affected by the convoy effect or the starvation problem as occurred in First Come First Serve
CPU Scheduling Algorithm.

Disadvantages:
The Disadvantages of Round Robin CPU Scheduling are:
1. Low Operating System slicing times will result in decreased CPU output.
2. Round Robin CPU Scheduling approach takes longer to swap contexts.
3. Time quantum has a significant impact on its performance.
4. The procedures cannot have priorities established.

Characteristics of Round Robin Scheduling in OS:

1. Round robin scheduling in OS is clock-driven (Hybrid model).


2. It is a Pre-emptive type of CPU scheduling algorithm in OS.
3. The round-robin algorithm generally focuses on the Time Sharing technique.
4. Round robin Scheduling is the simplest and one of the oldest algorithms.
5. This algorithm is a real-time algorithm as it responds to an event within a specific time limit.
6. Round robin is a widely used algorithm in traditional OS.

Resources Used:-

Sr.
No. Specification Remark
As per
1 Intel Core i3/ i5, RAM 4GB
requirement
As per
2 Operating System – Windows 10
requirement
As per
3 Application – Microsoft Word 2010
requirement
Conclusion:
Round Robin process scheduling algorithm works on the principle of round-robin, where an equal share
of an object is given to each person in turns. Oldest, fairest, and easiest scheduling algorithms. It spends
a lot of time on context switching. Worst-case latency is the maximum time taken for the execution of
all the tasks in the OS.
1. The name of this algorithm comes from the round-robin principle, where every person gets an equal
share of something turn by turn.
2. Every process gets executed cyclically, and the processing is done in FIFO order.
3. The execution of the Round Robin scheduling algorithm mainly depends on the value of the time
quantum.

References:

 https://www.javatpoint.com/round-robin-program-in-c
 https://data-flair.training/blogs/round-robin-scheduling-algorithm/

You might also like