get easy Round Robin Scheduling Program in C

Round Robin Scheduling Program in C

Here, you will know Round Robin Scheduling Algorithm using gantt chart and get the source code of Round Robin Scheduling Program in C programming language.

Round Robin Scheduling

Round Robin in operating system is a type of preemptive scheduling algorithm used in computer multitasking systems. It assigns CPU time in a cyclic way to each process in a queue. This ensures that every process is allocated a fair share of CPU time, and prevents the starvation of any process. It is particularly useful in time-sharing systems, where multiple users have access to the same computer.

Difference between FCFS and Round Robin

 

First Come First Served (FCFS) Round Robin (RR)
♦ First Come First Served (FCFS) scheduling algorithm is a scheduling algorithm where processes are scheduled according to their arrival time. ♦ Round Robin scheduling algorithm is a scheduling algorithm where processes are scheduled in a round-robin fashion.
♦ The process that arrives first will be scheduled first. ♦ Each process is given a fixed time slice (quantum), and once a process has used up its quantum. It is preempted and moved to the bottom of the ready queue.
♦ First Come First Served (FCFS) is non-preemptive scheduling algorithm. ♦ Round Robin(RR) is the preemptive and added to the end of the ready queue.

Working of Round Robin

Process            Burst time
P1                        48
P2                        16
P3                        62
P4                        28
 

Process P1 will be allocated for 20 time unit after then pre-empted to next process. This process will be continue till all process execution done.

round robin scheduling program in c

Waiting time of process=(start time-arrival time)+(new time -old finish time)
Step 1. Waiting time P1 = (0-0)+(76-20)+(124-96) = 84.
Step 2. Waiting time P2 = (20-0) = 20.
Step 3. Waiting time P3 = (36-0)+(96-56)+(132-116) = 92.
Step 4. Waiting time P4 = (56-0)+(116-76) = 96.

Step 5. Average Waiting time = (292)/4 = 73.

Waiting Time :  

Waiting Time = Turn around time – Burst Time.

Turn  Around Time :

Turn Around Time = Completion Time – Arrival Time.

                                        or

Turn around time = Burst time + Waiting time. 

Program code of Round Robin Scheduling Program in C

Output

round robin scheduling program in c output

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top