Вы находитесь на странице: 1из 19

PROGRAM IN ‘C’ FOR ROUND ROBIN SCHEDULING ALGORITHM

Micro - Project in:


Diploma V Semester
Operating Systems (22516)

Submitted By:

Srushti Kulpe - 41
Manish Khade - 40
Vandana Pabale - 39
Shubhayu Gaikwad - 33

Submitted To:
Mrs.Rushali Navale

PROGRAM OF COMPUTER ENGNEERING


2019-2020

Dr. D.Y Patil, School of Polytechnic, Vidyanagar,


Sec-7, Nerul, Navi Mumbai 400 706.
D.Y PATIL SCHOOL OF POLYTECHNIC
Sector – 7, Nerul, Navi Mumbai-400 706

CERTIFICATE

This is to certify that Mr. /Miss. / Mrs. _______________________________


Class __________________ Roll no. ______________ has completed the
Microproject work satisfactorily in the course of
_________________________________________________ as prescribed by
the Maharashtra State Board of Technical Education in the academic year 2018-
2019 in the program _________________________________________ of the
Institute ________________________________________________________.

Date ______________

Teacher______________ In charge Dep. _____________ Principal___________


ACKNOWLEDGEMENT

I take this opportunity to express deep sense of gratitude and sincere


thanks for the invaluable guidance that I have received at the worthy hands of
my guide Mrs.Rushali Navale.
I express my sincere thanks to our H.O.D. Prof. Umesh Patil for
permitting me to do this project and also to the entire staff member who have
helped me directly or indirectly.
I also express my thanks to my friends for their underlying support shown
during the preparation of this project.

_______________________

PROGRAM OF COMPUTER ENGINEERING


Dr. D.Y Patil, School of Polytechnic, Vidyanagar,
Sec-7, Nerul, Navi Mumbai 400 706.
INDEX

Report Part(A)

Sr. no. Content Page no.

1. Aim of Micro Project

2. Course Outcomes Addressed

3. Proposed Methodology

4. Action Plan

5. Actual Resources Used

Report Part (B)

1. Rationale

2. Aim of Micro-Project

3. Course Outcomes Achieved

4. Literature Review

5. Actual Methodology Followed

6. Actual Resources Used

7. Project Output

8. Skills Developed

9. Evaluation Sheet (A)

10. Evaluation Sheet (B)


1.0: AIM OF MICROPROJECT:

PROGRAM IN ‘C’ FOR ROUND ROBIN ALGORITHM.

2.0: COURSE OUTCOMES ADDRESSED:


A. Install operating system and configure it.
B. Use operating system tools to perform various functions.
C. Execute process commands for performing process management operations.
D. Apply scheduling algorithms to calculate turnaround time and average waiting time.
E. Calculate efficiency of memory management techniques.
F. Apply file management techniques.

3.0: PROPOSED METHODOLOGY:

In this micro project we may like to put forth information about Round Robin
Scheduling Algorithm. Round Robin (RR) scheduling algorithm is widely used
scheduling algorithm in multitasking. It ensures fairness and starvation free execution
of processes. Choosing the time quantum in RR is very crucial as small time slice results
in large number of context switches and large time quantum increases the response
time. Experimental analysis reveals that the proposed algorithm produces better
average turnaround time, average waiting time and fewer number of context switches
than existing algorithms.
4.0: ACTION PLAN:
Planned Planned
Name of
Sr.no Details of Activity Start Finish
Responsibilities
date date
Searched and selected the topic for
1
micro project.
2 Discussed about the micro project.

3 Distributed the work accordingly.


Collected and gathered the required
4
data.
5 Started working on the program.
Created the first basic steps for the
6
project.

7 Debugged the errors.


Discussed with the teacher about the
8
project.
Made the required changes told by
9
teacher.
10 Edited and prepared the report.
Prepared the hard copy of the micro
11
project.
Confirmed and reviewed the micro
12
project.
13 Prepared finalized copy of part B.
Showed the final execution of the
14
project.
Showed the final hard copy to the
15
guide.
16 Submitted the micro project.

Name and Signature of Faculty

5.0: RESOURCES REQUIRED:


Books:

1. Operating System Concepts – Silberchatz, Galvin – John Wiley and Sons, Ninth
Edition, 2015, ISBN: 978-51-265-5427-0
2. Operating System – Godbole, Achyut S. – Tata McGraw Hill Education, 2015,
ISBN: 978-00-705-9113-4
3. Operating System – Dr. Rajendra Kawale – Devraj Publications, Mumbai, ISBN:
978-81-933551-1-4

Electronic Sources:

1. https://en.wikipedia.org/wiki/Round-robin_scheduling
2. https://www.irjet.net/archives/V3/i3/IRJET-V3I3285.pdf
3. https://www.thecrazyprogrammer.com/2015/09/round-robin-scheduling-program-in-
c.html

Names of Team Members:


1. Shubhayu Gaikwad – 33.
2. Manish Khade – 40.
3. Vandana Pable – 39.
4. Srushti Kulpe – 41.
(To be approved by concerned Teacher)

1.0: RATIONALE:
Round Robin (RR) scheduling algorithm is widely used scheduling algorithm in
multitasking. It ensures fairness and starvation free execution of processes. Choosing
the time quantum in RR is very crucial as small time slice results in large number of
context switches and large time quantum increases the response time. Experimental
analysis reveals that the proposed algorithm produces better average turnaround
time, average waiting time and fewer number of context switches than existing
algorithms.

2.0: AIM OF MICRO PROJECT:


To develop a program in ‘C’ demonstrating the Round Robin Scheduling Algorithm.

3.0: COURSE OUTCOMES ACHIEVED:


A. Install operating system and configure it.
B. Use operating system tools to perform various functions.
C. Execute process commands for performing process management operations.
D. Apply scheduling algorithms to calculate turnaround time and average waiting time.

4.0: LITERATURE REVIEW:

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
fair share of CPU. One of the most commonly used technique in CPU scheduling as a core. It
is preemptive as processes are assigned CPU only for a fixed slice of time at the most. The
disadvantage of it is more overhead of context switching.
5.0: ACTUAL METHODOLOGY FOLLOWED:
Description:
 The Round Robin (RR) scheduling algorithm is designed especially for time sharing
systems. RR is the pre-emptive process scheduling algorithm.
 Round robin scheduling is the pre-emptive version of First Come First Serve (FCFS)
scheduling. Processes are dispatched in First In First Out (FIFO) sequence but each
process is allowed to run for only a limited amount of time.
 It is similar to FCFS scheduling but pre-emption is added to switch between processes.
A small unit of time called a Time Quantum or Time Slice is defined.
 A time quantum is generally from 10 to 100 milliseconds. The ready queue is treated
as a circular queue. The CPU scheduler goes around the ready queue, allocating CPU
to each process for a time interval of up to 1 time quantum.
 In RR scheduling process are dispatched FIFO but are given a limited amount of
processor time called a time slice or time quantum.
 If a process does not complete before its quantum expires, the system preempts it
and gives the processor to the next waiting process. The system then places the pre-
empted process at the back of the ready queue.
 In the fig. process P1 is dispatched to a processor, where it executes either until
completion, in which case it exits the system, or until its time slice expires, at which
point is pre-empted and placed at the tail of the ready queue. The scheduler then
dispatches process P2.

Dispatch
A B C D CPU Completed Job

Preemption
Timeout

Round Robin Scheduling

 To implement RR scheduling we keep ready queue as FIFO queue of processes. New


processes are added to the tail of the ready queue. The average waiting time under
the RR policy however is often quite long.

Example of round robin scheduling algorithm:

Assume there are 5 processes with process ID and burst time given below

PID Burst Time


P1 6
P2 5
P3 2
P4 3
P5 7

 Time quantum
 Assume that all process arrives at 0.

Now, we will calculate average waiting time for these processes to complete.

Solution:
We can represent execution of above processes using GANTT chart as shown below –

Round Robin Example Gantt Chart – 1


Explanation:

 First p1 process is picked from the ready queue and executes for 2 per unit time (time
slice = 2). If arrival time is not available, it behaves like FCFS with time slice.
 After P2 is executed for 2 per unit time, P3 is picked up from the ready queue. Since
P3 burst time is 2 so it will finish the process execution at once.
 Like P1 & P2 process execution, P4 and p5 will execute 2 time slices and then again it
will start from P1 same as above.
Waiting time = Turn Around Time – Burst Time
P1 = 19 – 6 = 13
P2 = 20 – 5 = 15
P3 = 6 – 2 = 4
P4 = 15 – 3 = 12
P5 = 23 – 7 = 16
Average waiting time = (13+15+4+12+16) / 5 = 12.
Flowchart:
C program code:
#include<stdio.h>
int main()
{

int count,j,n,time,remain,flag=0,time_quantum;
int wait_time=0,turnaround_time=0,at[10],bt[10],rt[10];
printf("Enter Total Process:\t ");
scanf("%d",&n);
remain=n;
for(count=0;count<n;count++)
{
printf("Enter Arrival Time and Burst Time for Process Process
Number %d :",count+1);
scanf("%d",&at[count]);
scanf("%d",&bt[count]);
rt[count]=bt[count];
}
printf("Enter Time Quantum:\t");
scanf("%d",&time_quantum);
printf("\n\nProcess\t|Turnaround Time|Waiting Time\n\n");
for(time=0,count=0;remain!=0;)
{
if(rt[count]<=time_quantum && rt[count]>0)
{
time+=rt[count];
rt[count]=0;
flag=1;
}
else if(rt[count]>0)
{
rt[count]-=time_quantum;
time+=time_quantum;
}
if(rt[count]==0 && flag==1)
{
remain--;
printf("P[%d]\t|\t%d\t|\t%d\n",count+1,time-at[count],time-
at[count]-bt[count]);
wait_time+=time-at[count]-bt[count];
turnaround_time+=time-at[count];
flag=0;
}

if(count==n-1)
count=0;
else if(at[count+1]<=time)
count++;
else
count=0;
}
printf("\nAverage Waiting Time= %f\n",wait_time*1.0/n);
printf("Avg Turnaround Time = %f",turnaround_time*1.0/n);

return 0;
}

6.0: ACTUAL RESOURCES USED:


Books:

1. Operating System Concepts – Silberchatz, Galvin – John Wiley and Sons, Ninth
Edition, 2015, ISBN: 978-51-265-5427-0
2. Operating System – Godbole, Achyut S. – Tata McGraw Hill Education, 2015,
ISBN: 978-00-705-9113-4

Electronic Sources:

1. https://en.wikipedia.org/wiki/Round-robin_scheduling.
2. https://www.irjet.net/archives/V3/i3/IRJET-V3I3285.pdf.
3. https://www.thecrazyprogrammer.com/2015/09/round-robin-scheduling-program-in-
c.html.

7.0: OUTPUT OF THE PROGRAM:


8.0: SKILLS DEVELOPED:
 From this we learnt about CPU scheduling in operating system.
 Also, we got to know about finding average waiting time and average turnaround time
each process executing in operating system.
 Round Robin scheduling is an algorithm mainly used by operating systems and
applications that serve multiple clients that request to use resources.

9.0: APPLICATIONS OF MICRO PROJECT:


This can be used as reference for people who want to learn Round Robin Algorithm.
This algorithm dramatically improves average response time. By limiting each task to a certain
amount of time, the operating system can ensure that it can cycle through all ready tasks,
giving each one a chance to run.

MICRO PROJECT EVALUATION SHEET (PART 1)


Name of student: …………………………….………… Enrolment no: …….……................
Name of programme: Computer Engineering Semester: V
Course Title: Operating Systems Code: 22516
Title of the Micro-Project: Program in ‘C’ for Round Robin Algorithm.
Course outcomes Achieved:
A. Install operating system and configure it.
B. Use operating system tools to perform various functions.
C. Execute process commands for performing process management
operations.
D. Apply scheduling algorithms to calculate turnaround time and average
waiting time.
Evaluation as per suggested Rubric for Assessment of Micro Project
Sr. Characteristics to be Poor Average Good Excellent
no. assessed (marks1-3) (marks4-5) (marks (maks9-
6-8) 10)
1. Relevance to course

2. Information
collection/literature
survey
3. Project proposal
4. Completion of the target
as per project proposal

5. Analysis of data and


representation
6. Quality of
prototype/model
7. Report preparation
8. Presentation

9. Defence

MICRO PROJECT EVALUATION SHEET (PART 2)


Academic Year: 2019-2020 Name of Faculty: Prof. Rushali Navale
Course: OSY Course code: 22516 Semester: V
Title of the project:
Cos Addressed by the Project:
The theory, practical experiences and relevant soft skills associated with this
course are to be taught and implemented so that the student demonstrated
the following industry-oriented COs associated with the above-mentioned
competency:
a. Install operating system and configure it.
b. Use operating system tools to perform various functions.
c. Execute process commands for performing process management
operations.
d. Apply scheduling algorithms to calculate turnaround time and average
waiting time.
e. Calculate efficiency of memory management techniques.
f. Apply file management techniques.
Comments/suggestions about team work/leadership/inter-personal
communication (if any)
………………………………..……………………………………………………………………….……………
……………………………………………………………………………………………………………………...
(A) (B)
Process and Individual Presentation / Total Marks
Product Assessment Viva 10
(6 Marks) (4 Marks)

Signature of Faculty

Вам также может понравиться