0% found this document useful (0 votes)
16 views1 page

Laboratory 1 Sem 1 2425

Uploaded by

Jack Ripper
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)
16 views1 page

Laboratory 1 Sem 1 2425

Uploaded by

Jack Ripper
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/ 1

Laboratory 1

Processes and Threads

Objective :
To simulate the CPU scheduling algorithm round-robin

ROUND ROBIN SCHEDULING ALGORITHM


Round Robin Scheduling is a scheduling algorithm used by the system to schedule CPU utilization. This
is a preemptive algorithm. There exist a fixed time slice associated with each request called the
quantum. The job scheduler saves the progress of the job that is being executed currently and moves
to the next job present in the queue when a particular process is executed for a given time quantum.

Advantages:

 Low overhead for decision making.


 Unlike other algorithms, it gives equal priority to all processes.
 Starvation rarely occurs in this process.

Disadvantages:

 The efficiency of the system is decreased if the quantum value is low as frequent switching
takes place.
 The system may become unresponsive if the quantum value is high.

Algorithm
1. Firstly, create a queue where the processes are arranged in first come first serve order.
2. A quantum value is allocated to execute each process.
3. The first process is executed until the end of the quantum value. After this, an interrupt is
generated and the state is saved.
4. The CPU then moves to the next process and the same method is followed.
5. Same steps are repeated till all the processes are over.

In the code, it is asking the user to enter the number of processes and arrival time and burst
time for each process. Then, the code calculates the waiting time and the turn around time using the
round-robin algorithm.
The main part is calculating the turn around time and the waiting time. Turn around time is
calculated by adding the total time taken and subtracting the arrival time.
The waiting time is calculated by subtracting the arrival time and burst time from the total
and adding it t0 the waiting time. This is how the round-robin scheduling takes place.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy