Question

(d) Pre-emptive priority scheduling [4 marks]: Consider the following set of processes, with the length of...

(d) Pre-emptive priority scheduling [4 marks]:

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:

Process

Burst

Priority

Arrival Time

P1

8

3

0

P2

3

4

1

P3

6

2

3

P4

3

1

5

P5

1

5

7

P6

3

8

14

P7

8

5

18

(d-1) Draw Gantt chart illustrating the execution of these processes using pre-emptive priority (a smaller priority number implies a higher priority) [2 marks]

00   01   02   03   04   05   06   07   08   09   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34

(d-2) Compute the turnaround time of all processes in the previous question [2 mark]

Process

Turnaround Time

P1

P2

P3

P4

P5

P6

P7

Average Turnaround Time

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q(d)

(d)-1

Sol:

We have the required Gantt Chart as follows:

Gantt Chart P1 P3 P4 P3 P1 P2 P5 P7 P6 3 5 8 12 17 20 21 29 32

Which can be explained as follows:

  • P1 enters at time=0 so P1 is executed first.
  • P2 enters at t=1 but its priority is less than P1 so P1 continues execution
  • P3 enters at t=3 with higher priority than P1 so P3 starts execution and P1 is pre-empted
  • Now, P3 does execution till t=5.
  • P4 enters execution at t=5 since it now has highest priority and it will complete its execution till t=8 because of highest priority.
  • Now, after P4, P3 has the highest priority so it will complete its execution till t=12
  • Now, after P3, P1 has the highest priority so it will complete its execution till t=17
  • Now, after P1, P2 has the highest priority so it will complete its execution till t=20
  • Now, after P2, P5 has the highest priority so it will complete its execution till t=21
  • Now, after P5, P7 has the highest priority so it will complete its execution till t=29
  • Now, after P5, P6 will complete its execution till t=32

(Note that all times are in millisecond(ms))

(d)-2

Sol:

We know that Turnaround Time = Completion Time - Arrival Time

So, we have the required table as follows (here completion time is found using the gantt chart where last executing time of the process is written):

Process Arrival Time(in ms) Completion Time(in ms) Turnaround Time(in ms)
P1 0 17 17 - 0 = 17
P2 1 20 20 - 1 = 19
P3 3 12 12 - 3 = 9
P4 5 8 8 - 5 = 3
P5 7 21 21 - 7 = 14
P6 14 32 32 - 14 = 18
P7 18 29 29 - 18 = 11

Average Turnaround Time = Sum of Turnaround times of all the processes/Number of processes

= (17 + 19 + 9 + 3 + 14 + 18 + 11)/7

= 91/7

= 13 ms (Ans.)

(Thank You !!, Please consider upvoting if it was helpful !!)

Add a comment
Know the answer?
Add Answer to:
(d) Pre-emptive priority scheduling [4 marks]: Consider the following set of processes, with the length of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:...

    Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process            Burst Time      Priority P1                    10                    3 P2                    1                     1 P3                    2                     3 P4                    1                     4 P5                    5                     2 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF (SPN), a...

  • QUESTION 1 Consider the following set of processes, with the length of the CPU burst time...

    QUESTION 1 Consider the following set of processes, with the length of the CPU burst time given in milliseconds: Process            Burst Time      Priority P1                    7                      5 P2                    2                      4 P3                    11                    3 P4                    9                      1 P5                    5                      3 The processes are assumed to have arrived in the order P1,P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 2). b. What...

  • Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:...

    Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process            Burst Time Priority P1                               5 4 P2                               3 1 P3                               1 2 P4                               7 2 P5                               4 3 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If nonpreemptive priority (a larger priority number implies a higher priority) is used, what is the average turnaround time of...

  • Computer Science Help Instructions Consider the following set of processes, with the length of the CPU-burst...

    Computer Science Help Instructions Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Burst Time Process P1 P2 Priority 10 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts illustrating the execution of these processes using FCFS, a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum 1) scheduling. b. What is the...

  • Please answer the following question in C++ language Consider the following set of processes, with the...

    Please answer the following question in C++ language Consider the following set of processes, with the length of the CPU burst time given in milliseconds: Process            Burst Time      Priority P1. 7 5 P2 2 4 P3 11 3 P4 9 1 P5 5 3 The processes are assumed to have arrived in the order P1,P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive...

  • Consider the following set of processes, with the length of the CPU burst given in milliseconds:

    Consider the following set of processes, with the length of the CPU burst given in milliseconds:ProcessBurst TimePriorityP1 54P231P312P472P543The processes are assumed to have arrived in the order P1 , P2 , P3 , P4 , P5 , all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2). b. What is the turnaround time of each...

  • Given the following set of processes with corresponding execution times (in ms), arrival times and priority...

    Given the following set of processes with corresponding execution times (in ms), arrival times and priority (1 – highest).  For each scheduling algorithm: Construct a table showing which process is active and for how long until all processes are completely serviced (as done in class). Calculate the average waiting time and turnaround time. Process ID Burst (ms) Arrival time P1 9 0 P2 12 0 P3 3 0 P4 30 0 P5 20 0 P6 10 0 First Come First Serve...

  • Q.2] Answer the following questions Process Burst Time Priority P1 3 1 P2 8 3 P3...

    Q.2] Answer the following questions Process Burst Time Priority P1 3 1 P2 8 3 P3 2 4 P4 4 5 P5 5 1 (21 points) Consider the set of processes shown in the table above, with the length of the CPU-burst time given in milliseconds. The processes are assumed to have arrived in the order P5, P4, P3, P2 , and P1, all approximately at time 0. Draw three Gantt charts illustrating the execution of these processes using SJF,...

  • Consider the following set of processes, with the length of CPU burst in milliseconds.

    Consider the following set of processes, with the length of CPU burst in milliseconds. Process PI P2 P3 P4 P5 Arrival time 00 02 03 06 30 Burst time 10 12 14 16 05 Draw a Gantt chart that illustrates the execution of these processes using the preemptive shorte st job first (SJF) algorithm. Hence find the average waiting time. Draw a Gantt chart that illustrate the execution of these processes using preemptive priority scheduling algorithm. Given priority of each...

  • Cpu scheduling

    Consider the following set of processes, with the length of the CPU burst times given in milliseconds:a. Draw four Gantt charts illustrating the execution of the processes using FCFS, Preemptive SJF, a non-preemptive priority, and a RR (quantum=2) scheduling. (30 pts)Note: for the RR consider that the arriving time is 0 for all processesb. What is the average waiting time of each process for of the above scheduling algorithms? (10 pts)P1 8 2 0 P2 5 36P3 1 1 8...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT