0% found this document useful (0 votes)
14 views3 pages

Exp 5

The document outlines a plan to design and implement a CPU scheduling algorithm for the 'Dev Darshan' system in a temple to manage waiting queues and reduce wait times for devotees. It discusses various non-preemptive scheduling algorithms including FCFS, SJF, Round Robin, and Priority scheduling, providing real-life examples for each. The implementation will consider factors such as the number of devotees, their priorities, and resource availability, with the goal of improving the overall experience for temple visitors.

Uploaded by

Disha Deshmukh
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)
14 views3 pages

Exp 5

The document outlines a plan to design and implement a CPU scheduling algorithm for the 'Dev Darshan' system in a temple to manage waiting queues and reduce wait times for devotees. It discusses various non-preemptive scheduling algorithms including FCFS, SJF, Round Robin, and Priority scheduling, providing real-life examples for each. The implementation will consider factors such as the number of devotees, their priorities, and resource availability, with the goal of improving the overall experience for temple visitors.

Uploaded by

Disha Deshmukh
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/ 3

Aim: With the increasing number of devotees visiting the temple, the wait time for "Dev Darshan"

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

improve the overall experience of visiting the temple.

Scope: The CPU scheduling algorithm will be implemented in the existing "Dev Darshan" system,

and will consider the following factors:

The number of devotees waiting in the queue.

The priority of each devotee, such as senior citizens, children, and differently-abled individuals.

The time taken by each devotee to complete "Dev Darshan".

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

turnaround time and waiting time.

a) FCFS

b) SJF

c) Round Robin

d) Priority

Theory:

● FCFS (First-Come-First-Served): FCFS is the simplest scheduling algorithm where the

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

also known as the shortest process next (SPN) algorithm.

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

works in CPU scheduling, where the shortest process is executed first.

● 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

processes have completed execution. The Round Robin algorithm is a preemptionbased


scheduling algorithm that aims to provide a fair share of CPU time to each

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

process in the queue.

● Priority scheduling: It is a scheduling algorithm where processes are executed based

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

starts executing, it continues to execute until it completes, regardless of whether a

higher-priority process arrives or not.

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.

Turn Around Time = Completion Time – Arrival Time

● Waiting Time(W.T): Time Difference between turn around time and burst time.

Waiting Time = Turn Around Time – Burst Time

Procedure:

1. Create a C file for each of the given CPU scheduling algorithms.

2. Take the number of processes as an input.

3. Take the process id, arrival time and burst time for each process as an input.

4. Calculate the average waiting time and turnaround time.

5. Create a Gannt Chart to display the sequence of execution of the activities. (Extra)

6. Display the output

You might also like