Os Assignment
Os Assignment
OPERATING SYSTEMS
process SCHEDULING ALGORITHMS IN OS
SUBMITTED BY: PAVITHRA BHEMIREDDE (2022btds002)
SUBMITTED TO: DR. ANITHA
Scheduling Algorithms in Operating
System
In this scheduling algorithm, jobs are executed on a first come, first serve
basis irrespective of burst time or priority. It is both a preemptive and non-
preemptive scheduling algorithm. It is based on the First In First Out
(FIFO) queue.
Advantages of FCFS:
Disadvantages of FCFS:
Inefficient throughput
If a process has a very high burst time and is coming first, then it will be
executed first even if another process with a lesser time is present in the
ready state
Waiting time of each process:
Process Waiting Time = Service Time – Arrival Time
P0 0–0=0
P1 5–1=4
P2 8–2=6
P3 16 – 3 = 13
Average Waiting Time = (0+4+6+13) / 4 = 5.75
Also known as shortest job first (SJF), this scheduling algorithm is both a
non-preemptive and preemptive scheduling algorithm. Process with the
minimum burst time at an instance executes first. It is very efficient in
minimizing the waiting time and is easy to implement in Batch systems. It
cannot be implemented if the required CPU time is not known in advance.
Process Arrival Time Execution Time Service Time
P0 0 5 0
P1 1 3 5
P2 2 8 14
P3 3 6 8
Waiting time of each process:
Process Waiting Time = Service Time – Arrival Time
P0 0–0=0
P1 5–1=4
P2 14 – 2 = 12
P3 8–3=5
Average Waiting Time = (0 + 4 + 12 + 5)/4 = 21 / 4 = 5.25
Advantages:
Disadvantages:
3. Priority Scheduling
Advantages:
Disadvantages:
There is a chance of starvation if only higher priority processes
keep coming in the ready state
If two processes have the same priorities, then some other
scheduling algorithm needs to be used.
Advantages:
Disadvantages:
The CPU is left idle due to a lot of context switching.
6. Multiple-Level Queues
There is a list of queues with different priorities and one with a higher
priority queue executes first. During execution of a process with a higher
priority queue comes, then the execution of the lower priority queue stops
and the one with higher priority queue replaces it. There is a chance of
starvation if the higher priority queue keeps coming in the ready state and
the lower priority queue keeps waiting for its turn.