Exp 5
Exp 5
has become longer, causing inconvenience to the devotees. This has resulted in a need for a more
efficient system that can manage the waiting queue and reduce the wait time for "Dev Darshan".
Goal: To design and implement a CPU scheduling algorithm for the "Dev Darshan" system in the
temple that can effectively manage the waiting queue, minimize the wait time for devotees, and
Scope: The CPU scheduling algorithm will be implemented in the existing "Dev Darshan" system,
The priority of each devotee, such as senior citizens, children, and differently-abled individuals.
The availability of resources, such as the number of "Dev Darshan" counters and the capacity of
the temple.
The solution will be tested and evaluated based on its ability to reduce the wait time for devotees,
improve the utilization of resources, and ensure fairness and equality in the allocation of resources.
Give the solution with example of Dev darshan CPU scheduling algorithm .
Write a program to simulate the following non-preemptive CPU scheduling algorithms to find
a) FCFS
b) SJF
c) Round Robin
d) Priority
Theory:
process that arrives first is executed first. The processes are executed in the order of
their arrival time, without considering the amount of time required for each process to
complete. This algorithm does not prioritize any process and does not have any
preemption mechanism.
An example of FCFS in real life would be waiting in line for a ride at an amusement park.
The first person in line gets to ride the ride first, and the others wait in the order they
arrived. This is similar to how FCFS works in CPU scheduling, where the first process to
arrive is executed first, and the others wait in the order they arrived.
● SJF (Shortest Job First): SJF is a scheduling algorithm where the process with the
shortest burst time is executed first. It prioritizes processes based on the time required
for them to complete. In SJF, the processes are ordered in ascending order of their burst
time, and the process with the shortest burst time is executed first. The SJF algorithm is
An example of SJF in real life would be a bakery preparing different types of baked
goods. If a baker receives an order for a cake that takes 30 minutes to bake, and then
receives another order for cupcakes that take 10 minutes to bake, the baker would start
with the cupcakes first since they take less time to bake. This is similar to how SJF
● Round Robin: Round Robin is a time-sharing scheduling algorithm where each process
is given a fixed time slice (also known as a quantum) to execute, after which the CPU is
swapped to the next process in the queue. This swapping is performed until all
process.
An example of Round Robin in real life would be a group of friends taking turns playing a
game. Each person gets a turn, and after their turn is up, they pass the game to the next
person. This is similar to how Round Robin works in CPU scheduling, where each
process gets a fixed time slice to execute, and then the CPU is swapped to the next
on their priority. Processes with higher priority are executed first, and if two processes
have the same priority, they are executed in FCFS order. The priority of a process can
be determined based on various factors, such as the amount of CPU time required, the
time it has already spent waiting in the queue, or the priority set by the user. The priority
scheduling algorithm is a non-preemptive algorithm, which means that once a process
An example of Priority in real life would be a doctor treating patients in a hospital. The
doctor would prioritize treating patients with critical or life-threatening conditions before
moving on to patients with less serious conditions. This is similar to how Priority
scheduling works in CPU scheduling, where processes with higher priority are executed
first.
● Completion Time (C.T.): The time at which the process completes its execution.
● Turn Around Time: Time Difference between completion time and arrival time.
● Waiting Time(W.T): Time Difference between turn around time and burst time.
Procedure:
3. Take the process id, arrival time and burst time for each process as an input.
5. Create a Gannt Chart to display the sequence of execution of the activities. (Extra)