Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Example 1: Draw the Gantt chart for the FCFS policy, considering the following set of

processes that arrive at time 0, with the length of CPU burst time given in m-sec. Also, calculate
the average waiting time.

Process Burst Time


P1 13
P2 08
P3 83

Example 2: Draw the Gantt chart, using SJF scheduling for the given data. Also calculate the
average waiting time.

Process Burst Time


P1 10
P2 03
P3 19
P4 82

Example 3: Using pre-emptive SJF scheduling, draw the Gantt chart and calculate the average
waiting time for the given data.

Process Arrival Time Burst Time


P1 00 19
P2 01 11
P3 02 83

Example 4: Schedule the given processes using priority scheduling when all the processes at the
time zero, in order P1, P2, ---- P5, with the length of CPU burst time given in milliseconds:

Process Burst Time Priority


P1 11 03
P2 02 01
P3 03 04
P4 02 05
P5 06 02

This study source was downloaded by 100000841649675 from CourseHero.com on 04-03-2024 15:25:51 GMT -05:00 Page | 1

https://www.coursehero.com/file/225758807/Tem-Numericaldocx/
Example 5: Consider the following set of processes that arrives at time 0 ms.

Process Burst Time


P1 20
P2 03
P3 04
If we use the time quantum of 4 ms then calculate the average waiting time using R-R
scheduling.

Example 6: Consider the following set of processes that arrive at time zero, with the length of
CPU burst time given in milliseconds:

Process Burst Time


P1 24
P2 03
P3 03
If we use the time quantum of 4 ms, schedule the process using R-R scheduling algorithm.

Example 7: For the given five processes arriving at time zero, in the order given with the length
of CPU burst time in milliseconds:

Process Burst Time


P1 10
P2 29
P3 03
P4 07
P5 12
Consider the FCFS, SJF and RR (quantum = 10 milliseconds) scheduling algorithms for this set
of processes. Which algorithm would give the minimum average waiting time?

Example 8: Consider the following four processes with the length of the CPU burst time in
millisecond:

Process Arrival Time Burst Time


P1 0 08
P2 01 04
P3 02 09
P4 03 05

This study source was downloaded by 100000841649675 from CourseHero.com on 04-03-2024 15:25:51 GMT -05:00 Page | 2

https://www.coursehero.com/file/225758807/Tem-Numericaldocx/
Find out which of the following algorithms gives the least average waiting time for the above
worked:

i. FCFS
ii. RR (Slice = 4 ms)
iii. SRTF

Example 9: Consider the following set of processes, with the length of the burst time given in
milliseconds:

Process Burst Time Priority


P1 10 03
P2 01 01
P3 02 03
P4 01 04
P5 05 02
The processes are assumed to have arrived in order P1, P2, P3, P4, and P5 all at time 0.

a) Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a
non pre-emptive priority (a smaller priority number implies a higher priority), and RR
(Quantum = 1) scheduling.
b) What is the turnaround time of each process for each of the scheduling algorithm in part
a?
c) What is the waiting time of each process for each of the scheduling algorithm in part a?
d) Which of the schedules in part a results in the minimal average waiting time (overall
processes)?

Example 10: Consider the following set of processes having their burst time mentioned in
milliseconds. CPU bust time indicates that for how much time, the process needs the CPU.

Process Burst Time


P1 20
P2 07
P3 05
Using the FCFS, calculate the average waiting time if the processes arrive in the order of:

i. P1, P2, P3
ii. P2, P3, P1

This study source was downloaded by 100000841649675 from CourseHero.com on 04-03-2024 15:25:51 GMT -05:00 Page | 3

https://www.coursehero.com/file/225758807/Tem-Numericaldocx/
iii. P3, P1, P2
iv. P3, P2, P1

Example 11:

Process Arrival Time Burst Time


P1 00 08
P2 01 04
P3 02 09
P4 03 05
Calculate average waiting time in

i. Preemptive SJF scheduling


ii. Non-preemptive SJF scheduling

Example 12: Consider the following set of processes, assumed to have arrived at time 0, in the
order P1, P2, P3, ----, P5, with the length of CPU bust time given in milliseconds:

Process Burst Time Priority


P1 10 03
P2 01 01
P3 02 04
P4 01 05
P5 05 02
Using priority scheduling, calculate the average waiting time.

Example 13:

Process Burst Time Priority Arrival Time


P1 10 03 00
P2 05 02 01
P3 02 01 02
Using preemptive priority scheduling algorithm, find out the average waiting time.

Example 14: Consider the set of processes given in the table and the following scheduling
algorithm:

i. Shortest Job First (SJF)


ii. Shortest Remaining Job First (SRTF)

This study source was downloaded by 100000841649675 from CourseHero.com on 04-03-2024 15:25:51 GMT -05:00 Page | 4

https://www.coursehero.com/file/225758807/Tem-Numericaldocx/
Process Arrival Time Burst Time
A 00 07
B 01 05
C 02 03
D 06 02
E 12 03
If there is a tie within the processes, the tie is broken in the favor of the oldest process. Draw the
Gantt chart and find the average waiting time and turnaround time for two algorithms. Comment
on your result which one is better and why?

Example 15: Consider a system with a set of processes P1, P2 and P3 and their CPU burst times,
priorities and arrival times being mentioned as below:

Process Burst Time Priority Arrival Time


P1 05 02 00
P2 15 03 01
P3 10 01 02
Assuming 1 to be the highest priority, calculate the following:

i. Average waiting time using FCFS, SJF (Preemptive and non-preemptive) and priority
(preemptive and non-preemptive) scheduling mechanism.
ii. Average turnaround time using FCFS, SJF (Preemptive and non-preemptive) and priority
(preemptive and non-preemptive) scheduling mechanism.
iii. Assume time quantum to be 2 units of time. Calculate average waiting time and average
turnaround time using RR scheduling.

Example 16: For the following table draws a chart illustrating their execution using:

i. FCFS
ii. SJF
iii. SRTF
iv. RR (quantum = 2)
v. RR (quantum = 1)

This study source was downloaded by 100000841649675 from CourseHero.com on 04-03-2024 15:25:51 GMT -05:00 Page | 5

https://www.coursehero.com/file/225758807/Tem-Numericaldocx/
Powered by TCPDF (www.tcpdf.org)

You might also like