# Arrival Time vs Burst Time vs Priority Time? If Priority Time is the same, which process dispatch first?

The question is based on if we have the same Priority value when we are given:

Arrival Time = AT, Priority and Burst Time=BT.
1.Say if we a table with AT, Priority and BT. To dispatch a process it is obvious that we check the AT first since we cannot predict the future.
2.If AT= 0 for all processes, we have to check the Priority.
**3.If p1 priority = p2 priority, what do we do next?**

Because of the equal PR value, now how do we draw a Gannt-Chart based on:
-FCFS
-SJF
-Priority Non-Preemptive

If all of them go by BT first, don't they all have the same Gantt-Chart since they are Non-preemptive.

After posting this, I decided to choose pick any process (random) when they have the same Priority value but I am not sure if they are correct. Actually there is only one question that affects the rest of the sub-questions but I just need to know that problem with the same Priority values above between two processes. If that one is answered, I could do the rest properly.

Thank you.

• There are too many questions here, it gets hard to parse. What have you tried so far? What have you read? – Evil May 18 '18 at 0:09
• This is only one question actually that leads to many questions. The one and only question is what do we do when we have two processes that have same Priority values, when we are given Burst Time and (all Arrival Time=0). How do we draw Gannt-Chart for FCFS, SJF and Non-Preemptive Priority. At the moment to me they all look the same. – JustinC May 18 '18 at 14:09
• Let me try them on paper with actual values and post them here. I like to solve them my selves, that's the reason why I don't want to post the whole thing here. Thanks. – JustinC May 18 '18 at 14:11

All Processes Arrival Time =0.
I finished this on my paper. Are they right?

Process  Burst  Priority
p1       4      3
p2       7      2
p3       2      6
p4       5      1
p5       4      2

Gannt-Chart - FCFS

| p4  | p5   | p2     | p1  |p2 |
0     5      9        16    20  22

Wait Time (WT) = (0+5+9+16+20)/5 = 50 / 5 = 10 m.s

Gannt-Chart - SJF

| p4  | p5   | p2     | p1  |p2 |
0     5      9        16    20  22
Wait Time (WT) = (0+5+9+16+20)/5 = 50 / 5 = 10 m.s

Gannt-Chart - Non-preemptive Priority

| p4  | p5   | p2     | p1  |p2 |
0     5      9        16    20  22
Average Wait Time (AWT) = (0+5+9+16+20)/5 = 50 / 5 = 10 m.s

Round Robin (Quantum=2)

|p4|p5|p2|p1|p3|p4|p5|p2|p1|P4|p2|p2|
0  2  4  6  8  10 12 14 16 18 19 21 22

P4 5-2-2-1-1=0
p5 4-2-2=0
p2 7-2-2-2-1=0
p1 4-2-2=0
p3 2-2=0

Average Wait Time (AWT)
p4 = 0+(10-2)+(18-12) =14
p5 = 2+(12-4)=10
p2 = 4+(14-6)+(19-16)=15
p1 = 6+(16-8)=14
p3 = 8

AVT = (14+10+15+14+8)/5= 9 m.s

Alternate or possible Gann-Chart for FCFS and Priority Non-Preemptive without Picking BT first.

Gannt-Chart - FCFS
| p4  | p2    | p5  | p1  |p2 |
0     5       12    16    20  22
Average Wait Time (AWT) = (0+5+12+16+20)/5 = 53 / 5 = 10.6 m.s

Gannt-Chart - Priority Non-Preemptive
| p4  | p2    | p5  | p1  |p2 |
0     5       12    16    20  22
Average Wait Time (AWT) = (0+5+12+16+20)/5 = 53 / 5 = 10.6 m.s