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

Scheduling Algorithms Implementation

The document discusses CPU scheduling algorithms, which manage process execution to enhance system efficiency and fairness. It outlines various strategies including FCFS, SJF, Priority Scheduling, and Round Robin, detailing their characteristics, advantages, and potential drawbacks like starvation. Each algorithm's input and output requirements for execution are also specified.

Uploaded by

sasankmanda8
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Scheduling Algorithms Implementation

The document discusses CPU scheduling algorithms, which manage process execution to enhance system efficiency and fairness. It outlines various strategies including FCFS, SJF, Priority Scheduling, and Round Robin, detailing their characteristics, advantages, and potential drawbacks like starvation. Each algorithm's input and output requirements for execution are also specified.

Uploaded by

sasankmanda8
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

CPU Scheduling Algorithms:

 A process that allows one process to use the CPU while another
process is delayed (in standby) due to unavailability of any resources
such as I / O etc.

 To make the system more efficient, faster and fairer.

 Impacts on CPU Utilization factor.


Reasons to schedule:

a) Selects which programs to choose for execution.

b) CPU time allocated for each process(Busy CPU & less response time)

c) Aids OS in “Context Switching”.

d) Throughput time for each process is maximized.

e) Turn around time should be minimum.


CPU Scheduling Strategies:
a) FCFS:
 The process that requests the CPU first is allocated the CPU first
and is implemented by using FIFO queue.
 Easy to implement and use.
 Not much efficient in performance and the wait time is quite high.
Process Burst Time
P1 13

P2 5

P3 49
b) SJF:
 Process that selects the waiting process with the smallest execution time to
execute next.
 Has the minimum average waiting time among all scheduling algorithms.
 Can lead to “Starvation".

Process Burst Time


P1 39
P2 5
P3 7
P4 1
P5 3
c) Priority Scheduling:
works based on the priority of a process.
 Higher priority tasks are executed first. (Lower No, higher value)
 Less complex and average waiting time is less to FCFS.
 Can lead to “Starvation".
Proces Burst Time
Priority
s
4
P1 39
3
P2 5
2
P3 7
0
P4 1
1
P5 3
d) RR:
 Each process is cyclically assigned a fixed time slot. (Time Slice)
 Simple, easy, starvation free technique.
 Fairer approach.
Process Burst Time
P1 5

P2 3

P3 2

P4 4
P3

P2

P4

P1

Queue:
Step 1: Assign time slice=2
Step 2: P3 executes completely in cycle 1.
P3
P2
P4
P1

Step 3: P2 (Burst time =3-2=1)


P3 P2

Step 4: P4 (Burst time =4-2=2)


P3 P2 P4
Step 5: P1 (Burst time =5-2=3)
P3 P2 P4 P1

Step 6: P2 (Burst time =1), P4 (Burst time =2-1=1)


P3 P2 P4 P1 P2, P4

P4

P1
Step 7: P1 (Burst time =3-2=1),
P3 P2 P4 P1 P2, P4 P1

Step 8: P4 (Burst time =1), P1 (Burst time =1),


P3 P2 P4 P1 P2, P4 P1 P4, P1

Total time allocated = 6*2=12 units


Program I/O:

1) FCFS:
I/P: Process names, burst time
O/P: Process execution order, average waiting time.

2) SJF:
I/P: Process names, burst time
O/P: Process execution order, average waiting time.
3) Priority:

I/P: Process names, burst times, priority values

O/P: Process execution order, average waiting time.

4) RR:

I/P: Process names, burst times, time slice

O/P: Process execution order, average waiting time.

You might also like