-1
$\begingroup$
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.
| cite | improve this question | | | | |
$\endgroup$
  • $\begingroup$ There are too many questions here, it gets hard to parse. What have you tried so far? What have you read? $\endgroup$ – Evil May 18 '18 at 0:09
  • $\begingroup$ 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. $\endgroup$ – JustinC May 18 '18 at 14:09
  • $\begingroup$ 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. $\endgroup$ – JustinC May 18 '18 at 14:11
-1
$\begingroup$

1. Consider the following set of processes, with the length of the CPU burst and given in milliseconds:


Process    Time    Burst     Priority

P1                0           4            3 

P2                0           7            2

P3                0           2            6

P4                0           5            1

P5                0           4            2


          WT                       BT 

|----------------------- |-------------------------|

AT                                                 CT                 

|----------------------TAT-----------------------|


The processes are assumed to have arrived in the order P1, P2, P3, P4, P5 all at time 0.

a.) Draw four Gantt chars that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, Non-preemptive Priority (a smaller priority number implies a higher priority), and RR (quantum=2).

b.) What is the turnaround time of each process for each of the scheduling algorithms in part a?

c.) What is the waiting time of each process for each of these scheduling algorithms?


Process    Time    Burst     Priority

P1                0           4            3

P2                0           7            2

P3                0           2            6

P4                0           5            1

P5                0           4            2



Complete Time = CT

Turn Around Time = TAT 

Burst Time = BT

Wait Time = WT

Average Wait Time = AWT


WT = TAT - BT

TAT = CT - AT


Since they all arrived at time 0 but in order of P1, P2, P3, P4 P5. We run at P1 first down to P5 in order on FCFS disregarding the Priority
I think I got a lot of wrong here since I was not paying attention. 
                                    CT-AT      TAT-BT 
Process AT  Burst  Priority   CT     TAT        WT
p1      0    4         3      4       4         0
p2      0    7         2      11      11        4
p3      0    2         6      13      13        11 
p4      0    5         1      18      18        13
p5      0    4         2      22      22        18


Gannt-Chart - FCFS

| p1  | p2   | p3    |   p4  |  p5  |
0     4     11      13      18      22
Needs a lot of corrections below:
AWT = (0+4+11+13+18)/5 = 46 / 5 = 9.2 ms

TAT = (4+11+13+18+22)/5 = 68/5=13.6 ms

******************

Gannt-SJF


1. Sort all the processes in increasing order according to burst time. 

2. Then simply, apply FCFS.

There is a tie between P1 and P5 because Burst is 4 so two Gannt-Chart

P1 first


| p3  | p1   | p5   |   p4  |    p2 |
0     2     6      10       15     22

AWT = (0+2+6+10+15)/5 = 33/5 = 6.6 ms

TAT = (2+6+10+15+22)/5 =55/5= 11 ms

P5 first


| p3  | p5   | p1   |   p4  |    p2 |
0     2      6     10      15      22

AWT = (0+2+6+10+15)/5 = 33/5 = 6.6 ms

TAT = (2+6+10+15+22)/5 = 55/5 = 11 ms

*****************

Gannt-Chart - Non-preemptive Priority

1. Sort all the processes in increasing order according to priority

2. Then simply, apply FCFS.


There is a tie between p2 and p5 because priority is 2.

p2 first

| p4  | p2   | p5    |   p1  |    p3    |
0     5     12      16       20        22

AWT = (0+5+12+16+20)/5 = 10.6 ms

TAT =(5+12+16+20+22) /5 = 75/5 =15 ms


p5 first

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

AWT = (0+5+9+16+20)/5 = 10 ms

TAT = (5+9+16+20+22)/5 = 14.4 ms

*************************
Gannt-Chart Round Robin (Quantum=2)


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

AWT = (8+15+4+16+14)/5 = 11.4 ms

TAT = (12+22+6+21+18)/5= 79 / 4 = 15.8 ms


| cite | improve this answer | | | | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.