0% found this document useful (0 votes)
81 views7 pages

FCFS Scheduling Example and Calculations

The document presents calculations for waiting and turnaround times for multiple sets of processes using different scheduling policies. It includes detailed examples with process IDs, arrival times, burst times, completion times, and the formulas used for calculations. Average waiting and turnaround times are provided for each set of processes, demonstrating the impact of scheduling on performance metrics.

Uploaded by

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

FCFS Scheduling Example and Calculations

The document presents calculations for waiting and turnaround times for multiple sets of processes using different scheduling policies. It includes detailed examples with process IDs, arrival times, burst times, completion times, and the formulas used for calculations. Average waiting and turnaround times are provided for each set of processes, demonstrating the impact of scheduling on performance metrics.

Uploaded by

kumardavidashwin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Problem-01:

Consider an example, there are 4 processes with


process ID P0, P1, P2, and P3. The arrival time of P0 is
0, P1 is 1, P2 is 2, and P3 is 3.

The waiting time and Turnaround time are calculated


with the help of the following formula.

Waiting Time = Turnaround time – Burst Time


Turnaround Time = Completion time – Arrival time

Process ID Arrival Time Burst Time Completion Time Turnaround Time Waiting Time

P0 0 6 6 6 0

P1 1 8 14 13 5

P2 2 10 24 22 12

P3 3 12 36 33 21

Average Waiting Time = 0+5+12+21/4


= 38/4
= 9.5 ms

Average Turnaround Time = 6+13+22+33/4


=74/4
= 18.5 ms
Problem-02:

Wait time of each process is as follows −

Process Wait Time : Service Time - Arrival Time

P0 0-0=0

P1 5-1=4

P2 8-2=6

P3 16 - 3 = 13

Average Wait Time: (0+4+6+13) / 4 = 5.75


Problem-03:

Process Burst time Arrival time

P1 6 2

P2 3 5

P3 8 1

P4 3 0

P5 4 4

Waiting time = Start time - Arrival time

P4 = 0-0 = 0

P3 = 3-1 = 2

PI = 11-2 = 9

P5= 17-4 = 13

P2= 21-5= 16

Average Waiting Time

= 40/5= 8
Consider the set of 3 processes whose arrival time and burst time are given
below-

Process Id Arrival time Burst time

P1 0 2

P2 3 1

P3 5 6

If the CPU scheduling policy is FCFS, calculate the average waiting time and average turn
around time.

Gantt Chart-

Here, black box represents the idle time of CPU.

Now, we know-
 Turn Around time = Exit time – Arrival time
 Waiting time = Turn Around time – Burst time

Process Id Exit time Turn Around time Waiting time


P1 2 2–0=2 2–2=0

P2 4 4–3=1 1–1=0

P3 11 11- 5 = 6 6–6=0

Now,
 Average Turn Around time = (2 + 1 + 6) / 3 = 9 / 3 = 3 unit
 Average waiting time = (0 + 0 + 0) / 3 = 0 / 3 = 0 unit

Consider the set of 5 processes whose arrival time and burst time are given below-

Process Id Arrival time Burst time

P1 3 4

P2 5 3

P3 0 2

P4 5 1

P5 4 3
If the CPU scheduling policy is FCFS, calculate the average waiting time and average turn
around time.

Gantt Chart-

Here, black box represents the idle time of CPU.

Now, we know-
 Turn Around time = Exit time – Arrival time
 Waiting time = Turn Around time – Burst time

Process Id Exit time Turn Around time Waiting time

P1 7 7–3=4 4–4=0

P2 13 13 – 5 = 8 8–3=5

P3 2 2–0=2 2–2=0

P4 14 14 – 5 = 9 9–1=8

P5 10 10 – 4 = 6 6–3=3

Now,
 Average Turn Around time = (4 + 8 + 2 + 9 + 6) / 5 = 29 / 5 = 5.8 unit
 Average waiting time = (0 + 5 + 0 + 8 + 3) / 5 = 16 / 5 = 3.2 unit

You might also like