In: Computer Science
i | t(pi) | Priority |
0 | 80 | 2 |
1 | 25 | 4 |
2 | 15 | 3 |
3 | 20 | 4 |
4 | 45 | 1 |
The jobs are assumed to arrive at the same time. Using priority scheduling followed by FCFS, do the following:
Hello there!
Here all the processes arrived at the same time assuming the arrival time of all processing as 0.
We have to use Priority Scheduling. (Highest Priority First. i.e. Process with priority 4 will be executed first then with 3, 2, and at last 1).
Gantt Chart :
Step 1: Find the process/es with the highest priority.
=> We have two processes P1 and P3 with the highest priority (4). And applying FCFS (First Come First Serve) Process P1 came first thus will execute first. And then obviously Process P3 will execute.
Step 2: Repeat Step 1 with the remaining process until all the processes are executed.
(A) The Gantt Chart will look like this.
25 20 15 80 45
P1 | P3 | P2 | P0 | P4 |
0 25 45 60 140 185
1. The First Row in the chart contains burst time (or execution time) for the processes specified below
2. The columns in the 2nd row specifies processes executed.
3. The 3rd row shows the timeline.
(B) Turnaround time for process P1
Turnaround time = Finish time of process - arrival time of the process
TAT(P1) = 25(finish time shown in chart) - 0(arrival time)
= 25
(C) Waiting Time
Waiting time is defined as the time the process has to wait before getting CPU after arrival.
Here, the arrival time of all processes is 0 as all arrived at the same time.
WT(P0) = 60 - 0 = 60
WT(P1) = 0
WT(P2) = 45 - 0 = 45
WT(P3) = 25 - 0 = 25
WT(P4) = 140 - 0 = 140
Hope it Helps!