SlideShare a Scribd company logo
COMPUTER ENGINEERING
OPERATING SYSTEMS
MICROPROJECT
Title of the Microproject : Round Robin Algorithm
GROUP MEMBERS
SR.NO NAME ROLL
NO.
CLASS REMARKS
1. Adil Qureshi 3129 CO51
2. Rajnandini Singh 3139 CO5I
3. Ashwin Avhale 3158 CO5I
Guide Name : Ashwini Ma’am
PLAN A
Title : Round Robin Algorithm
1.0 Introduction :
Round Robin is a CPU scheduling algorithm where each process
is assigned a fixed time slot in a cyclic way. It is simple, easy to
implement, and starvation-free as all processes get a fair share of
CPU. One of the most used techniques in CPU scheduling as a
core. It is preemptive as processes are assigned CPU only for a
fixed slice of time at most. The disadvantage of it is more
overhead of context switching.
FIFO simply queues process in the order that they arrive in the
ready queue. This is commonly used for a task queue, for
example as illustrated in this section.
2.0 Aim of Micro Project :
The main aim of our project is to understand the concept of Round
Robin Algorithm.
3.0 Action Plan :
SR
NO.
Details of Action Planned
Start
Date
Planned
End
Date
Name of
Team
Members
1. Groups form according
to roll
no. and group leader
were selected.
22/08/2022 2/09/2022
2. Finalization of micro
project as well as
discussion
regarding topic
5/09/2022 16/09/2022
3. Planning on the micro
project regarding
resources, language
uses, software uses,
submission date.
19/09/2022 16/09/2022
4. Complete analysis and
design part of micro
project and distribution
of module among group
members.
3/10/2022 30/09/2022
5. Collecting information
regarding the project on
use
case diagram for library
management system
and getting it finalize
from guide
17/10/2022 28/10/2022
6. Implementation of
the project by
making information
or details of the
given topic.
31/10/2022 11/11/2022
7. Presentation in front
of guide by each
member of group
and preparing post B
Plan of project.
14/11/2022 25/11/2022
8. Submission of micro
project both plan A
and plan B hard copy
28/11/2022 9/12/2022
4.0 Resources Required:
Sr.No Name of
Resources
required
Specification Quantity Remarks
1. Computer 11th Gen
Intel(R)
Core (TM)
i5-1135G7
@ 2.40GHz
1
2. MS Word -------- 1
3. Web
browser
Collecting
info.
1
PLAN B
 Title: Round Robin Algorithm
Round Robin (RR) scheduling algorithm is the widely used
scheduling algorithm in multitasking. It ensures fairness and
starvation free execution of processes. Choosing the time
quantum in RR algorithm is very crucial as small time slice results
in large number of context switches and large time quantum
increases the response time. To overcome these problems of RR
scheduling, instead of static time slice dynamic time slice can be
used to get optimal performance. The objective of this paper is to
modify RR algorithm by adjusting time slices of different rounds
depending on the remaining CPU bursts of currently running
processes and considering their waiting times until that round in
respect of the other processes waiting times. Experimental
analysis reveals that the proposed algorithm produces better
average turnaround time, average waiting time and fewer context
switches than existing algorithms.
2.0 Aim of Micro Project :
The main aim of our project is to understand the concept
of Round Robin Algorithm.
Course Outcome integrated :
We have understood the concept of Round Robin
Algorithm.
Actual Procedure Followed :
1. Group Formation: The team of 4 students for micro
project was formed in the first week and the topic for
micro project was given. Detailed information regarding
the microproject such as marking scheme, part A part B
plan and submission dates were given. The team Leader
was also selected by the group.
2. Finalization of project: During this week various topics
of microproject were selected by us, from which one was
finalized that is making a Number Guessing Game.
3. Planning of the project: Once the project was finalized,
we started working on that. We learned about the
importance first. We planned regarding the hardware and
software requirement, algorithm, flowchart, part A and
part B plan, etc. During this week we also distributed the
work among team members.
4. Analysis part: In this part we gathered the detail and
implemented it step by step by writing the program code
which makes it easy for us to understand what our project
is. By the end of this week, we approved the project by
making changes according to the guide.
5. Design part : It is the implementation of analysis part.
In this part we created the program code. This makes it
easier to understand the problem.
6. Implementation: In this stage, we implemented the
program code in which we achieved the desired output.
Each member created the program for their own part. We
have taken all the precautions while doing the program.
7. Presentation: We presented our project in front of the
guide. Each module was explained in detail. The
questioning session was done by the guide in which she
asked to make various changes. By this week, both part A
& part B were ready with us.
8. Submission: This week was submission week. We
submitted our micro-project with the changes as told by
the guide. We also submitted the soft copy of the project.
Actual Resources Required:
Sr.No Name of
Resources
required
Specification Quantity Remarks
1. Computer 11th Gen
Intel(R)
Core (TM) i5-
1135G7
@ 2.40GHz
1
2. MS Word -------- 1
3. Web
browser
Collecting
info.
1
First Come, First Served (FCFS)
First Come First Serve is the simplest and easiest scheduling
algorithm. In this algorithm, the CPU is allocated to the processes
in the order they request it. The implementation of FCFS is
easily done with a queue (a FIFO structure). When the first
process enters the system it starts its execution immediately and
runs till it completes its execution. As other processes enter the
system, they are put at the end of the queue and wait to get the
CPU. When a process finishes executing, it releases the CPU, is
removed from the queue and the CPU is allocated to next process
at the head of the queue.
 First come, first served (FCFS) is an operating system
process scheduling algorithm and a network routing
management mechanism that automatically executes
queued requests and processes by the order of their arrival.
 With first come, first served, what comes first is handled
first; the next request in line will be executed once the one
before it is complete.
 FCFS is also known as first-in, first-out (FIFO) and first
come, first choice (FCFC).
Example:
pro
cess
Burst time
P1 25
P2 4
P3 3
The processes arrive in the order P1, P2, P3 and are served as per
the FCFS algorithm. The Gantt chart is as shown:
P1 P2 P3
0 25
29 32
The waiting time for P1 is 0 milliseconds, for P2 it is 25
milliseconds and 29 milliseconds for P3. Thus, average waiting
time is (0+25+29)/3 = 18 milliseconds.
 Advantage:
o It is easy to understand and implement.
o Simple
o Easy
o First come, First serve
 Disadvantage:
 It is a non-pre-emptive scheduling algorithm: Once a
process has been allocated the CPU, it will not release the
CPU until it finishes executing. Thus, it is not suitable for
modern systems which work on the principle of time
sharing.
 The Average Waiting Time is high.
 It results in convay effect i.e., many processes which
require CPU for short duration must wait for a bigger
process to finish thus resulting in low resource utilization.
 Implementation:
1) Input the processes along with their burst time (bt).
2) Find waiting time (wt) for all processes.
3) As first process that comes need not to wait so
waiting time for process 1 will be 0 i.e. wt[0] = 0.
4) Find waiting time for all other processes i.e. for
process i ->
wt[i] = bt[i-1] + wt[i-1].
5)Find turnaround time = waiting_time + burst_time
for all processes.
6) Find average waiting time =
total_waiting_time / no_of_processes.
7) Similarly, find average turnaround time =
total_turn_around_time / no_of_processes.
Code:
// C++ program for implementation of FCFS
// scheduling
#include<iostream>
using namespace std;
// Function to find the waiting time for all
// processes
void findWaitingTime(int processes [], int n,
int bt[], int wt[])
{
// waiting time for first process is 0
wt[0] = 0;
// calculating waiting time
for (int i = 1; i < n ; i++ )
wt[i] = bt[i-1] + wt[i-1] ;
}
// Function to calculate turn around time
void findTurnAroundTime( int processes[], int n,
int bt[], int wt[], int tat[])
{
// calculating turnaround time by adding
// bt[i] + wt[i]
for (int i = 0; i < n ; i++)
tat[i] = bt[i] + wt[i];
}
//Function to calculate average time
void findavgTime( int processes[], int n, int bt[])
{
int wt[n], tat[n], total_wt = 0, total_tat = 0;
//Function to find waiting time of all processes
findWaitingTime(processes, n, bt, wt);
//Function to find turn around time for all processes
findTurnAroundTime(processes, n, bt, wt, tat);
//Display processes along with all details
cout << "Processes "<< " Burst time "
<< " Waiting time " << " Turn around timen";
// Calculate total waiting time and total turn
// around time
for (int i=0; i<n; i++)
{
total_wt = total_wt + wt[i];
total_tat = total_tat + tat[i];
cout << " " << i+1 << "tt" << bt[i] <<"t "
<< wt[i] <<"tt " << tat[i] <<endl;
}
cout << "Average waiting time = "
<< (float)total_wt / (float)n;
cout << "nAverage turn around time = "
<< (float)total_tat / (float)n;
}
// Driver code
int main()
{
//process id's
int processes[] = { 1, 2, 3};
int n = sizeof processes / sizeof processes[0];
//Burst time of all processes
int burst_time[] = {10, 5, 8};
findavgTime(processes, n, burst_time);
return 0; }
}
Manual Output:
Proces
ses
Burst
time
Waiting
time
Turnaround
time
1 10 0 10
2 5 10 15
3 8 15 23
Average waiting time = 8.33333
Average turnaround time = 16
System Output:
Use case Diagram of FCFS:
Data Flow Diagram for FCFS:
Class Diagram for FCFS:
Round Robin is a CPU scheduling algorithm where each process
is assigned a fixed time slot in a cyclic way.
 It is simple, easy to implement, and starvation-free as all
processes get a fair share of CPU.
 One of the most used techniques in CPU scheduling as a
core.
 It is preemptive as processes are assigned CPU only for a
fixed slice of time at most.
 The disadvantage of it is more overhead of context
switching
To schedule processes fairly, a round-robin scheduler generally
employs time-sharing, giving each job a time slot or (its
allowance of CPU time), and interrupting the job if it is not
completed by then. The job is resumed next time a time slot is
assigned to that process. If the process terminates or changes its
state to waiting during its attributed time quantum, the scheduler
selects the first process in the ready queue to execute. In the
absence of time-sharing, or if the quanta were large relative to the
sizes of the jobs, a process that produced large jobs would be
favored over other processes.
 Round-robin algorithm is a pre-emptive algorithm as the
scheduler forces the process out of the CPU once the time
quota expires.
 For example, if the time slot is 100 milliseconds, and job1
takes a total time of 250 ms to complete, the round-robin
scheduler will suspend the job after 100 ms and give other
jobs their time on the CPU. Once the other jobs have had
their equal share (100 ms each), job1 will get another
allocation of CPU time and the cycle will repeat. This
process continues until the job finishes and needs no more
time on the CPU.
1)Completion Time: Time at which process completes its
execution.
2)Turn Around Time: Time Difference between completion time
and arrival time.
3)Turn Around Time = Completion Time – Arrival Time
4)Waiting Time (W.T): Time Difference between turnaround
time and burst time.
5)Waiting Time = Turn Around Time – Burst Time
Steps to find waiting times of all processes:
1)Create an array rem_bt[] to keep track of remaining
burst time of processes. This array is initially a
copy of bt[] (burst times array)
2) Create another array wt[] to store waiting times
of processes. Initialize this array as 0.
3) Initialize time: t = 0
4)Keep traversing all processes while all processes
are not done. Do following for its process if it is
not done yet.
a- If rem_bt[i] > quantum
(i) t = t + quantum
(ii) bt_rem[i] -= quantum;
c- Else // Last cycle for this process
(i) t = t + bt_rem[i];
(ii) wt[i] = t - bt[i]
(ii) bt_rem[i] = 0; // This process is over
Code with the example no2: -
// C++ program for implementation of RR scheduling
#include<iostream>
using namespace std;
// Function to find the waiting time for all
// processes
void findWaitingTime(int processes[], int n,
int bt[], int wt[], int quantum)
{
// Make a copy of burst times bt[] to store remaining
// burst times.
int rem_bt[n];
for (int i = 0 ; i < n ; i++)
rem_bt[i] = bt[i];
int t = 0; // Current time
// Keep traversing processes in round robin manner
// until all of them are not done.
while (1)
{
bool done = true;
// Traverse all processes one by one repeatedly
for (int i = 0 ; i < n; i++)
{
// If burst time of a process is greater than 0
// then only need to process further
if (rem_bt[i] > 0)
{
done = false; // There is a pending process
if (rem_bt[i] > quantum)
{
// Increase the value of t i.e. shows
// how much time a process has been processed
t += quantum;
// Decrease the burst_time of current process
// by quantum
rem_bt[i] -= quantum;
}
// If burst time is smaller than or equal to
// quantum. Last cycle for this process
else
{
// Increase the value of t i.e. shows
// how much time a process has been processed
t = t + rem_bt[i];
// Waiting time is current time minus time
// used by this process
wt[i] = t - bt[i];
// As the process gets fully executed
// make its remaining burst time = 0
rem_bt[i] = 0;
}
}
}
// If all processes are done
if (done == true)
break;
}
}
// Function to calculate turn around time
void findTurnAroundTime(int processes[], int n,
int bt[], int wt[], int tat[])
{
// calculating turnaround time by adding
// bt[i] + wt[i]
for (int i = 0; i < n ; i++)
tat[i] = bt[i] + wt[i];
}
// Function to calculate average time
void findavgTime(int processes[], int n, int bt[],
int quantum)
{
int wt[n], tat[n], total_wt = 0, total_tat = 0;
// Function to find waiting time of all processes
findWaitingTime(processes, n, bt, wt, quantum);
// Function to find turn around time for all processes
findTurnAroundTime(processes, n, bt, wt, tat);
// Display processes along with all details
cout << "Processes "<< " Burst time "
<< " Waiting time " << " Turn around timen";
// Calculate total waiting time and total turn
// around time
for (int i=0; i<n; i++)
{
total_wt = total_wt + wt[i];
total_tat = total_tat + tat[i];
cout << " " << i+1 << "tt" << bt[i] <<"t "
<< wt[i] <<"tt " << tat[i] <<endl;
}
cout << "Average waiting time = "
<< (float)total_wt / (float)n;
cout << "nAverage turn around time = "
<< (float)total_tat / (float)n;
}
// Driver code
int main()
{
// process id's
int processes[] = { 1, 2, 3};
int n = size of processes / size of processes[0];
// Burst time of all processes
int burst_time[] = {10, 5, 8};
// Time quantum
int quantum = 2;
findavgTime(processes, n, burst_time, quantum);
return 0;
}
 Manual Output:
Processes Burst time
time
Waiting time Turn around
1 10 13 23
2 5 10 15
3 8 13 21
Average waiting time = 12
Average turnaround time = 19.6667
 System output:
Use case Diagram of Round Robin:
Data flow diagram of Round Robin:
 Conclusion:
 Thus, we have performed various scheduling algorithms
such as FCFS (First Come First Serve) and Round Robin
Algorithm. We have developed a C plus program to
execute these algorithms. We have calculated waiting time,
turnaround time, burst time. We have created a Use case
and Data Flow Diagram for both algorithms.

More Related Content

Similar to Document 14 (6).pdf

AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUMAN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUMijcseit
 
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUMAN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUMijcseit
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.pptKeyreSebre
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
Embedded systems unit4
Embedded systems unit4Embedded systems unit4
Embedded systems unit4baskaransece
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .nathansel1
 
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike MullerFaster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike MullerPyData
 
Unit iios process scheduling and synchronization
Unit iios process scheduling and synchronizationUnit iios process scheduling and synchronization
Unit iios process scheduling and synchronizationdonny101
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptxDivyaKS18
 
Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven schedulingKamal Acharya
 
A survey of paradigms for building and
A survey of paradigms for building andA survey of paradigms for building and
A survey of paradigms for building andcseij
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu schedulingpiku das
 
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal BootRenesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal Bootandrewmurraympc
 
Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler Yoshitake Kobayashi
 
Cpu scheduling algorithm on windows
Cpu scheduling algorithm on windowsCpu scheduling algorithm on windows
Cpu scheduling algorithm on windowssiddhartha pande
 

Similar to Document 14 (6).pdf (20)

AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUMAN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
 
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUMAN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
AN OPTIMIZED ROUND ROBIN CPU SCHEDULING ALGORITHM WITH DYNAMIC TIME QUANTUM
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
Unit 2 notes
Unit 2 notesUnit 2 notes
Unit 2 notes
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Embedded systems unit4
Embedded systems unit4Embedded systems unit4
Embedded systems unit4
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
In computing, scheduling is the action .
In computing, scheduling is the action .In computing, scheduling is the action .
In computing, scheduling is the action .
 
Pipeline Computing by S. M. Risalat Hasan Chowdhury
Pipeline Computing by S. M. Risalat Hasan ChowdhuryPipeline Computing by S. M. Risalat Hasan Chowdhury
Pipeline Computing by S. M. Risalat Hasan Chowdhury
 
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike MullerFaster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
 
Unit iios process scheduling and synchronization
Unit iios process scheduling and synchronizationUnit iios process scheduling and synchronization
Unit iios process scheduling and synchronization
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
Fcfs and sjf
Fcfs and sjfFcfs and sjf
Fcfs and sjf
 
Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven scheduling
 
A survey of paradigms for building and
A survey of paradigms for building andA survey of paradigms for building and
A survey of paradigms for building and
 
Ijariie1161
Ijariie1161Ijariie1161
Ijariie1161
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal BootRenesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
 
Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler Improvement of Scheduling Granularity for Deadline Scheduler
Improvement of Scheduling Granularity for Deadline Scheduler
 
Cpu scheduling algorithm on windows
Cpu scheduling algorithm on windowsCpu scheduling algorithm on windows
Cpu scheduling algorithm on windows
 

Recently uploaded

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxViniHema
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionjeevanprasad8
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptssuser9bd3ba
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientistgettygaming1
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industriesMuhammadTufail242431
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdfKamal Acharya
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationRobbie Edward Sayers
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-IVigneshvaranMech
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsAtif Razi
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageRCC Institute of Information Technology
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxMd. Shahidul Islam Prodhan
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdfKamal Acharya
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdfKamal Acharya
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...Amil baba
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdfKamal Acharya
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Aryaabh.arya
 

Recently uploaded (20)

power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 

Document 14 (6).pdf

  • 1. COMPUTER ENGINEERING OPERATING SYSTEMS MICROPROJECT Title of the Microproject : Round Robin Algorithm GROUP MEMBERS SR.NO NAME ROLL NO. CLASS REMARKS 1. Adil Qureshi 3129 CO51 2. Rajnandini Singh 3139 CO5I 3. Ashwin Avhale 3158 CO5I Guide Name : Ashwini Ma’am
  • 2. PLAN A Title : Round Robin Algorithm 1.0 Introduction : Round Robin is a CPU scheduling algorithm where each process is assigned a fixed time slot in a cyclic way. It is simple, easy to implement, and starvation-free as all processes get a fair share of CPU. One of the most used techniques in CPU scheduling as a core. It is preemptive as processes are assigned CPU only for a fixed slice of time at most. The disadvantage of it is more overhead of context switching. FIFO simply queues process in the order that they arrive in the ready queue. This is commonly used for a task queue, for example as illustrated in this section.
  • 3. 2.0 Aim of Micro Project : The main aim of our project is to understand the concept of Round Robin Algorithm. 3.0 Action Plan : SR NO. Details of Action Planned Start Date Planned End Date Name of Team Members 1. Groups form according to roll no. and group leader were selected. 22/08/2022 2/09/2022 2. Finalization of micro project as well as discussion regarding topic 5/09/2022 16/09/2022 3. Planning on the micro project regarding resources, language uses, software uses, submission date. 19/09/2022 16/09/2022
  • 4. 4. Complete analysis and design part of micro project and distribution of module among group members. 3/10/2022 30/09/2022 5. Collecting information regarding the project on use case diagram for library management system and getting it finalize from guide 17/10/2022 28/10/2022 6. Implementation of the project by making information or details of the given topic. 31/10/2022 11/11/2022 7. Presentation in front of guide by each member of group and preparing post B Plan of project. 14/11/2022 25/11/2022 8. Submission of micro project both plan A and plan B hard copy 28/11/2022 9/12/2022
  • 5. 4.0 Resources Required: Sr.No Name of Resources required Specification Quantity Remarks 1. Computer 11th Gen Intel(R) Core (TM) i5-1135G7 @ 2.40GHz 1 2. MS Word -------- 1 3. Web browser Collecting info. 1
  • 6. PLAN B  Title: Round Robin Algorithm Round Robin (RR) scheduling algorithm is the widely used scheduling algorithm in multitasking. It ensures fairness and starvation free execution of processes. Choosing the time quantum in RR algorithm is very crucial as small time slice results in large number of context switches and large time quantum increases the response time. To overcome these problems of RR scheduling, instead of static time slice dynamic time slice can be used to get optimal performance. The objective of this paper is to modify RR algorithm by adjusting time slices of different rounds depending on the remaining CPU bursts of currently running processes and considering their waiting times until that round in respect of the other processes waiting times. Experimental analysis reveals that the proposed algorithm produces better average turnaround time, average waiting time and fewer context switches than existing algorithms.
  • 7. 2.0 Aim of Micro Project : The main aim of our project is to understand the concept of Round Robin Algorithm. Course Outcome integrated : We have understood the concept of Round Robin Algorithm.
  • 8. Actual Procedure Followed : 1. Group Formation: The team of 4 students for micro project was formed in the first week and the topic for micro project was given. Detailed information regarding the microproject such as marking scheme, part A part B plan and submission dates were given. The team Leader was also selected by the group. 2. Finalization of project: During this week various topics of microproject were selected by us, from which one was finalized that is making a Number Guessing Game. 3. Planning of the project: Once the project was finalized, we started working on that. We learned about the importance first. We planned regarding the hardware and software requirement, algorithm, flowchart, part A and part B plan, etc. During this week we also distributed the work among team members.
  • 9. 4. Analysis part: In this part we gathered the detail and implemented it step by step by writing the program code which makes it easy for us to understand what our project is. By the end of this week, we approved the project by making changes according to the guide. 5. Design part : It is the implementation of analysis part. In this part we created the program code. This makes it easier to understand the problem. 6. Implementation: In this stage, we implemented the program code in which we achieved the desired output. Each member created the program for their own part. We have taken all the precautions while doing the program. 7. Presentation: We presented our project in front of the guide. Each module was explained in detail. The questioning session was done by the guide in which she asked to make various changes. By this week, both part A & part B were ready with us.
  • 10. 8. Submission: This week was submission week. We submitted our micro-project with the changes as told by the guide. We also submitted the soft copy of the project. Actual Resources Required: Sr.No Name of Resources required Specification Quantity Remarks 1. Computer 11th Gen Intel(R) Core (TM) i5- 1135G7 @ 2.40GHz 1 2. MS Word -------- 1
  • 11. 3. Web browser Collecting info. 1 First Come, First Served (FCFS) First Come First Serve is the simplest and easiest scheduling algorithm. In this algorithm, the CPU is allocated to the processes in the order they request it. The implementation of FCFS is easily done with a queue (a FIFO structure). When the first process enters the system it starts its execution immediately and runs till it completes its execution. As other processes enter the system, they are put at the end of the queue and wait to get the CPU. When a process finishes executing, it releases the CPU, is
  • 12. removed from the queue and the CPU is allocated to next process at the head of the queue.  First come, first served (FCFS) is an operating system process scheduling algorithm and a network routing management mechanism that automatically executes queued requests and processes by the order of their arrival.  With first come, first served, what comes first is handled first; the next request in line will be executed once the one before it is complete.  FCFS is also known as first-in, first-out (FIFO) and first come, first choice (FCFC). Example: pro cess Burst time P1 25 P2 4 P3 3
  • 13. The processes arrive in the order P1, P2, P3 and are served as per the FCFS algorithm. The Gantt chart is as shown: P1 P2 P3 0 25 29 32 The waiting time for P1 is 0 milliseconds, for P2 it is 25 milliseconds and 29 milliseconds for P3. Thus, average waiting time is (0+25+29)/3 = 18 milliseconds.  Advantage: o It is easy to understand and implement. o Simple o Easy o First come, First serve  Disadvantage:
  • 14.  It is a non-pre-emptive scheduling algorithm: Once a process has been allocated the CPU, it will not release the CPU until it finishes executing. Thus, it is not suitable for modern systems which work on the principle of time sharing.  The Average Waiting Time is high.  It results in convay effect i.e., many processes which require CPU for short duration must wait for a bigger process to finish thus resulting in low resource utilization.  Implementation: 1) Input the processes along with their burst time (bt). 2) Find waiting time (wt) for all processes. 3) As first process that comes need not to wait so waiting time for process 1 will be 0 i.e. wt[0] = 0.
  • 15. 4) Find waiting time for all other processes i.e. for process i -> wt[i] = bt[i-1] + wt[i-1]. 5)Find turnaround time = waiting_time + burst_time for all processes. 6) Find average waiting time = total_waiting_time / no_of_processes. 7) Similarly, find average turnaround time = total_turn_around_time / no_of_processes. Code: // C++ program for implementation of FCFS // scheduling #include<iostream> using namespace std; // Function to find the waiting time for all
  • 16. // processes void findWaitingTime(int processes [], int n, int bt[], int wt[]) { // waiting time for first process is 0 wt[0] = 0; // calculating waiting time for (int i = 1; i < n ; i++ ) wt[i] = bt[i-1] + wt[i-1] ; } // Function to calculate turn around time void findTurnAroundTime( int processes[], int n, int bt[], int wt[], int tat[]) {
  • 17. // calculating turnaround time by adding // bt[i] + wt[i] for (int i = 0; i < n ; i++) tat[i] = bt[i] + wt[i]; } //Function to calculate average time void findavgTime( int processes[], int n, int bt[]) { int wt[n], tat[n], total_wt = 0, total_tat = 0; //Function to find waiting time of all processes findWaitingTime(processes, n, bt, wt); //Function to find turn around time for all processes findTurnAroundTime(processes, n, bt, wt, tat);
  • 18. //Display processes along with all details cout << "Processes "<< " Burst time " << " Waiting time " << " Turn around timen"; // Calculate total waiting time and total turn // around time for (int i=0; i<n; i++) { total_wt = total_wt + wt[i]; total_tat = total_tat + tat[i]; cout << " " << i+1 << "tt" << bt[i] <<"t " << wt[i] <<"tt " << tat[i] <<endl; } cout << "Average waiting time = " << (float)total_wt / (float)n;
  • 19. cout << "nAverage turn around time = " << (float)total_tat / (float)n; } // Driver code int main() { //process id's int processes[] = { 1, 2, 3}; int n = sizeof processes / sizeof processes[0]; //Burst time of all processes int burst_time[] = {10, 5, 8}; findavgTime(processes, n, burst_time); return 0; } } Manual Output:
  • 20. Proces ses Burst time Waiting time Turnaround time 1 10 0 10 2 5 10 15 3 8 15 23 Average waiting time = 8.33333 Average turnaround time = 16 System Output:
  • 21. Use case Diagram of FCFS: Data Flow Diagram for FCFS:
  • 23. Round Robin is a CPU scheduling algorithm where each process is assigned a fixed time slot in a cyclic way.
  • 24.  It is simple, easy to implement, and starvation-free as all processes get a fair share of CPU.  One of the most used techniques in CPU scheduling as a core.  It is preemptive as processes are assigned CPU only for a fixed slice of time at most.  The disadvantage of it is more overhead of context switching To schedule processes fairly, a round-robin scheduler generally employs time-sharing, giving each job a time slot or (its allowance of CPU time), and interrupting the job if it is not completed by then. The job is resumed next time a time slot is assigned to that process. If the process terminates or changes its state to waiting during its attributed time quantum, the scheduler selects the first process in the ready queue to execute. In the absence of time-sharing, or if the quanta were large relative to the sizes of the jobs, a process that produced large jobs would be favored over other processes.
  • 25.  Round-robin algorithm is a pre-emptive algorithm as the scheduler forces the process out of the CPU once the time quota expires.  For example, if the time slot is 100 milliseconds, and job1 takes a total time of 250 ms to complete, the round-robin scheduler will suspend the job after 100 ms and give other jobs their time on the CPU. Once the other jobs have had their equal share (100 ms each), job1 will get another allocation of CPU time and the cycle will repeat. This process continues until the job finishes and needs no more time on the CPU. 1)Completion Time: Time at which process completes its execution. 2)Turn Around Time: Time Difference between completion time and arrival time. 3)Turn Around Time = Completion Time – Arrival Time 4)Waiting Time (W.T): Time Difference between turnaround time and burst time. 5)Waiting Time = Turn Around Time – Burst Time
  • 26. Steps to find waiting times of all processes: 1)Create an array rem_bt[] to keep track of remaining burst time of processes. This array is initially a copy of bt[] (burst times array) 2) Create another array wt[] to store waiting times of processes. Initialize this array as 0. 3) Initialize time: t = 0 4)Keep traversing all processes while all processes are not done. Do following for its process if it is not done yet. a- If rem_bt[i] > quantum (i) t = t + quantum (ii) bt_rem[i] -= quantum; c- Else // Last cycle for this process
  • 27. (i) t = t + bt_rem[i]; (ii) wt[i] = t - bt[i] (ii) bt_rem[i] = 0; // This process is over Code with the example no2: - // C++ program for implementation of RR scheduling #include<iostream> using namespace std; // Function to find the waiting time for all // processes void findWaitingTime(int processes[], int n, int bt[], int wt[], int quantum) { // Make a copy of burst times bt[] to store remaining // burst times.
  • 28. int rem_bt[n]; for (int i = 0 ; i < n ; i++) rem_bt[i] = bt[i]; int t = 0; // Current time // Keep traversing processes in round robin manner // until all of them are not done. while (1) { bool done = true; // Traverse all processes one by one repeatedly for (int i = 0 ; i < n; i++) { // If burst time of a process is greater than 0
  • 29. // then only need to process further if (rem_bt[i] > 0) { done = false; // There is a pending process if (rem_bt[i] > quantum) { // Increase the value of t i.e. shows // how much time a process has been processed t += quantum; // Decrease the burst_time of current process // by quantum rem_bt[i] -= quantum; }
  • 30. // If burst time is smaller than or equal to // quantum. Last cycle for this process else { // Increase the value of t i.e. shows // how much time a process has been processed t = t + rem_bt[i]; // Waiting time is current time minus time // used by this process wt[i] = t - bt[i]; // As the process gets fully executed // make its remaining burst time = 0 rem_bt[i] = 0; }
  • 31. } } // If all processes are done if (done == true) break; } } // Function to calculate turn around time void findTurnAroundTime(int processes[], int n, int bt[], int wt[], int tat[]) { // calculating turnaround time by adding // bt[i] + wt[i] for (int i = 0; i < n ; i++)
  • 32. tat[i] = bt[i] + wt[i]; } // Function to calculate average time void findavgTime(int processes[], int n, int bt[], int quantum) { int wt[n], tat[n], total_wt = 0, total_tat = 0; // Function to find waiting time of all processes findWaitingTime(processes, n, bt, wt, quantum); // Function to find turn around time for all processes findTurnAroundTime(processes, n, bt, wt, tat); // Display processes along with all details
  • 33. cout << "Processes "<< " Burst time " << " Waiting time " << " Turn around timen"; // Calculate total waiting time and total turn // around time for (int i=0; i<n; i++) { total_wt = total_wt + wt[i]; total_tat = total_tat + tat[i]; cout << " " << i+1 << "tt" << bt[i] <<"t " << wt[i] <<"tt " << tat[i] <<endl; } cout << "Average waiting time = " << (float)total_wt / (float)n; cout << "nAverage turn around time = "
  • 34. << (float)total_tat / (float)n; } // Driver code int main() { // process id's int processes[] = { 1, 2, 3}; int n = size of processes / size of processes[0]; // Burst time of all processes int burst_time[] = {10, 5, 8}; // Time quantum int quantum = 2; findavgTime(processes, n, burst_time, quantum);
  • 35. return 0; }  Manual Output: Processes Burst time time Waiting time Turn around 1 10 13 23 2 5 10 15 3 8 13 21 Average waiting time = 12 Average turnaround time = 19.6667
  • 36.  System output: Use case Diagram of Round Robin:
  • 37. Data flow diagram of Round Robin:
  • 38.  Conclusion:  Thus, we have performed various scheduling algorithms such as FCFS (First Come First Serve) and Round Robin Algorithm. We have developed a C plus program to execute these algorithms. We have calculated waiting time, turnaround time, burst time. We have created a Use case and Data Flow Diagram for both algorithms.