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

Exp No 5 Round Robin Using LL 221070068

This document describes an experiment that implements a round-robin scheduling algorithm using a circular linked list. It represents processors as nodes in the list and simulates allocating CPU time based on a quantum time. Each processor node stores its ID, execution time, and a pointer to the next node. The algorithm allows each processor to run once per iteration until all complete their tasks. It has O(n) time and space complexity, where n is the number of processes. The program provides a practical demonstration of how round-robin scheduling allocates CPU time fairly between processors.

Uploaded by

luffysan2208
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)
44 views

Exp No 5 Round Robin Using LL 221070068

This document describes an experiment that implements a round-robin scheduling algorithm using a circular linked list. It represents processors as nodes in the list and simulates allocating CPU time based on a quantum time. Each processor node stores its ID, execution time, and a pointer to the next node. The algorithm allows each processor to run once per iteration until all complete their tasks. It has O(n) time and space complexity, where n is the number of processes. The program provides a practical demonstration of how round-robin scheduling allocates CPU time fairly between processors.

Uploaded by

luffysan2208
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/ 7

Name: Arnav Phad

Reg No: 221070051

EXPERIMENT No: 5
Round Robin using LL

AIM:
Design and implement a round-robin scheduling algorithm for a set of
processors with variable execution times utilizing a circular linked list to
represent the processors, and it simulates the execution of processes based
on a predefined quantum time.

THEORY:
The Round-Robin scheduling algorithm is one of the simplest and widely used
algorithms, especially in time-sharing systems. The program implemented
here simulates a basic round-robin scheduling scenario using a circular linked
list data structure.

The processors are represented using a circular linked list, where each node
of the list corresponds to a processor. The circular nature ensures that the
scheduling algorithm loops back to the beginning after reaching the end,
creating a continuous cycle.

Each node of the linked list, represented by the node structure, contains
information about a processor, including its ID, execution time, and a pointer
to the next processor in the list. Additionally, each processor has an

associated quantum time, representing the fixed time quantum for the round-
robin scheduling.
PROGRAM:
OUTPUT:
EXAMPLE:

The time provided by the architecture is 3s in each iteration for the processor
to run. The time when all its tasks are executed, the processor is no longer
taken into consideration.
In the above diagram, processor p0 requires 5s , p1 requires 3s, p2 requires
8s and p3 requires 6s, respectively to complete all their tasks.

In the first iteration, i.e up to the block 4, all take 3s to execute.

For second iteration:


Time remaining(RT) for each processor to execute it’s task:
1. po = 2s.
2. p1 = 0s.
3. p2 = 5s.
4. p3 = 3s.
For the processors with RT less than quantum time, execute for RTs and
ones
with 0s, stop execution, and are no longer displayed.

So, with the help of a circular linked list execution time gets reduced and
Round-Robin scheduling allows each processor to execute once in every
iteration, till all of them are completed with their required execution(i.e their RT
becomes 0s).

ALGORITHM:

CONCLUSION:
In conclusion, the overall time complexity of this Round Robin scheduling
algorithm is O(n), where n is the number of processes. This is because each
operation (insert, quantum, delete) individually takes O(n) time in the worst
case, and these operations are not nested but are called sequentially. The space
complexity of the program is also O(n) for storing the processes in the circular
linked list. Here, n is the number of processes

This program provides a practical implementation of the round-robin


scheduling algorithm, demonstrating its fairness in allocating CPU time to a
set of processors. The simulation results can be used to evaluate the
efficiency and fairness of the algorithm under different scenarios, making it a
valuable tool for understanding and experimenting with CPU scheduling in
time-sharing systems.

You might also like