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

FCFS (Non-Preemptive) :: Process ID Arrival Time Burst Time Priority

The document discusses implementing different scheduling algorithms - FCFS, SJF (preemptive and non-preemptive), and priority scheduling - on 7 processes with varying arrival times and burst times. It analyzes the average turnaround time and waiting time for each algorithm. It finds that SJF has the minimum average turnaround and waiting time of 6.28 and 4.28 respectively. The conclusion is that SJF is optimal as it gives the least average waiting time for a given set of processes and CPU burst times.

Uploaded by

Ansa Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

FCFS (Non-Preemptive) :: Process ID Arrival Time Burst Time Priority

The document discusses implementing different scheduling algorithms - FCFS, SJF (preemptive and non-preemptive), and priority scheduling - on 7 processes with varying arrival times and burst times. It analyzes the average turnaround time and waiting time for each algorithm. It finds that SJF has the minimum average turnaround and waiting time of 6.28 and 4.28 respectively. The conclusion is that SJF is optimal as it gives the least average waiting time for a given set of processes and CPU burst times.

Uploaded by

Ansa Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

You are required to implement different scheduling algorithm on the following

number of processes e.g. FCFS (non-preemptive), SJF (non-preemptive &


Preemptive) and Priority Scheduling (Preemptive) and conclude which algorithm
has min average turnaround time and average waiting time and why?

Process ID Arrival Time Burst Time Priority


P1 3 1 1
P2 1 2 10
P3 5 2 2
P4 2 4 5
P5 6 1 3
P6 0 3 2
P7 4 1 7
FCFS(Non-Preemptive):
GANT chart:

P6 P2 P4 P1 P7 P3 P5
0 3 5 9 10 11 13 14

P-ID ST CT TAT=CT-AT WT=TAT-BT

P6 0 03 3=3-0 0=3-3

P2 03 05 4=5-1 2=4-2

P4 05 09 7=9-2 3=7-4

P1 09 10 7=10-3 6=7-1

P7 10 11 7=11-4 6=7-1

P3 11 13 8=13-5 6=8-2

P5 13 14 8=14-6 7=8-1

Average TAT= Σ44/7=6.28


Average WT= Σ30/7=4.2

SJF(Non-Preemptive):
GANT chart:
P6 P1 P7 P2 P5 P3 P4
0 3 4 5 7 8 10 14
P-ID ST CT TAT=CT-AT WT=TAT-BT
P6 0 03 3=3-0 0=3-3
P1 03 04 1=4-3 0=1-1

P7 04 05 1=5-4 0=1-1

P5 05 06 6=7-1 4=6-2

P2 06 08 2=8-6 1=2-1

P3 08 10 5=10-5 3=5-2

P4 10 14 12=14-2 8=12-4

Average TAT= Σ30/7=6.28


Average WT= Σ16/7=4.28

SJF(Preemptive):
GANT chart:
P6 P1 P7 P2 P5 P2 P3 P4
0 3 4 5 6 7 8 10 14
P-ID ST CT TAT=CT-AT WT=TAT-BT
P6 0 03 3=3-0 0=3-3
P1 03 04 1=4-3 0=1-1

P7 04 05 1=5-4 0=1-1

P2 05 07 6=7-1 4=6-2

P5 07 08 2=8-6 1=2-1

P3 08 10 5=10-5 3=5-2
P4 10 14 12=14-2 8=12-4

Average TAT= Σ30/7=6.28


Average WT= Σ16/7=4.28

Priority scheduling (Preemptive):


GANT chart:
P6 P2 P4 P7 P4 P5 P6 P3 P1
0 1 3 4 5 8 9 11 13 14
P-ID ST CT TAT=CT-AT WT=TAT-BT
P6 0 11 11=11-0 8=11-3
P2 01 03 2=3-1 0=2-2

P4 03 08 6=8-2 2=6-4

P7 04 05 1=5-4 0=1-1

P5 08 09 3=9-6 2=3-1

P3 11 13 8=13-5 6=8-2

P1 13 14 11=14-3 10=11-1

Average TAT= Σ42/7=6


Average WT= Σ28/7=4
Conclusion:
SJF has minimum average turn around and waiting time and SJF is
provably optimal, in that for a given set of processes and their CPU bursts/execution
times it gives the least average waiting time for each process.

You might also like