Question

In: Computer Science

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

Arrival

Time

P1

10

3

0

P2

1

1

12

P3

2

4

0

P4

1

5

0

P5

5

2

0

In the above table, a smaller priority number implies a higher priority. Suppose that these processes are scheduled by the priority policy with preemption.

  1. Draw the Gantt chart (i.e., time chart) illustrating the execution of these processes.
  2. What is the waiting time of each individual process?
  3. What is the average waiting time for these processes?

Solutions

Expert Solution

In Priority Scheduling, we run the process first which has higher priority.

In Preemption, CPU scheduling algo is invoked under 3 conditions,

  1. When a process wishes to perform I/O . Therefore, CPU scheduling algo is invoked to select a next new process.

  2. When a process terminates and therefore CPU scheduling algo is invoked

  3. When a process is forcefully removed from the CPU.(Process voluntarily leaves)

here, Process will interrupt only when it is interrupted or when a process of higher priority is waiting in ready queue.

a) Gantt chart is the chart which shows the sequence in which process was completed.

  • At 0 time, we have four processes P1, P3, P4, P5
  • P5 is the highest priority so it'll occur from 0-5 (5 is the burst time)
  • Now, P1 is the higher priority so it'll occur for 5-12 as at 12 P2 occurs which is of highest priority.
  • Then P2 completes at 13 and P1 executes which gets complete at 16.
  • Now, P3 occurs from 16-18 then P4 from 18-19

THE GANTT CHART IS:

P5 P1 P2 P1 P3 P4

0 5 12 13 16 18 19 ------- TIME

On the basis of the gantt chart we can find completion time, Turn Around Time and Waiting Time

  • Completion Time is time of completion of process.
  • Turn Around Time is time taken to complete from when it arrived.
  • Waiting Time is the time taken to start executing from when it arrived.
  • Turn Around Time = Completion Time - Arrival Time
  • Waiting Time = Turn Around Time - Burst Time
PROCESS PRIORITY ARRIVAL TIME BURST TIME COMPLETION TIME TURN AROUND TIME WAITING TIME
P1 3 0 10 16 16 6
P2 1 12 1 13 1 0
P3 4 0 2 18 18 16
P4 5 0 1 19 19 18
P5 2 0 5 5 5 0

b) Waiting Time of P1, P2, P3, P4, P5 are 6, 0, 16, 18, 0

c) Average Waiting Time = ( 6 + 0 + 16 + 18 + 0 ) / 5

= 40 / 5

= 8 milliseconds


Related Solutions

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     P1                             5         P2                             3             P3                             1           P4                             7            P5                             4            The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If FCFS scheduling is used, what is the average turnaround time of these processes? Answer: Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process          Burst Time     P1                             5         P2                             3             P3                             1           P4                             7            P5                             4           ...
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 Arrival Time Burst Time P1 0 5 P2 2 3 P3 3 2 P4 4 4 P5 5 3 a. Draw Gantt charts illustrating the execution of these processes using SJF pre-emptive b. What is the turnaround time of each process for each of the scheduling algorithms c. What is the waiting time of each process for each of the scheduling algorithms  
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: Process Burst Time Priority P1 2 2 P2 1 1 P3 8 4 P4 4 2 P5 5 3 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, non preemptive priority (a smaller priority number implies...
1. Consider the following set of processes, with the length of CPU burst and arrival time...
1. Consider the following set of processes, with the length of CPU burst and arrival time given in milliseconds.                                                              Process            Burst time       Priority            Arrival Time             P1                         10                    3                              0 P2                          1                     1                              2 P3                          2                     4                              4 P4                          5                     2                              8 a) Draw the Gantt chart that illustrates the execution of these processes using the preemptive priority scheduling algorithm (a smaller priority number implies a higher priority). b) What...
A set of processes along with their burst time in milliseconds is given below. The processes...
A set of processes along with their burst time in milliseconds is given below. The processes should execute in First Come First Served order. Assume that the quantum (q) is 3: Process Burst Time P1 22 P2 4 P3 12 P4 15 P5 2 Find the average waiting time using the Round Robin algorithm. Round your answer to 2 decimal places
Consider the set of processes shown in the table above, with the length of the CPU-burst...
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, Round-Robin (quantum size = 3), and a non-preemptive priority (a smaller priority number implies a higher priority) scheduling. Calculate average waiting time of each scheduling. Calculate...
You are given the following processes with CPU-burst time, arrival time and priority (lower # means...
You are given the following processes with CPU-burst time, arrival time and priority (lower # means higher priority) Process CPU-burst Arrival time Priority P1 12 0 5 P2 6 6 2 P3 9 1 2 P4 14 3 1 P5 7 5 4 For each of the following scheduling algorithm, show (using the diagram as in the slides), how the process are being executed. Also calculate the average wait time. Shortest job first (non-preemptive) Shortest remaining job first (preemptive) Priority-based...
6. Consider the following set of processes P1, P2, P3, P4. Process Burst Time Arrival Time...
6. Consider the following set of processes P1, P2, P3, P4. Process Burst Time Arrival Time Priority P1 3 0 1 P2 5 1 2 P3 8 3 3 P4 4 4 2 a) Draw Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: first-come, first-served (FCFS), priority scheduling (larger number=high priority), and Round-Bobin (RR, quantum=2). b) Compute the average waiting time, turnaround time for the three algorithms. Turnaround time – amount of time to...
Consider the following set of jobs to be scheduled for execution on a single CPU system....
Consider the following set of jobs to be scheduled for execution on a single CPU system. Job Arrival Time Burst (msec) Priority A 0 6 3 (Silver) B 1 2 1 (Diamond) C 3 5 3 (Silver) D 5 3 4 (Bronze) E 7 2 2 (Gold)    (a)     Draw a Gantt chart showing First-Come-First-Served (FCFS) scheduling for these jobs. (b)     Draw a Gantt chart showing preemptive PRIORITY scheduling. (c)    Draw a Gantt chart showing Highest Response Ratio Next (HRRN) scheduling. (d)     Draw a...
Consider the following set of jobs to be scheduled for execution on a single CPU system....
Consider the following set of jobs to be scheduled for execution on a single CPU system. Job Arrival Time Burst (msec) Priority A 0 6 3 (Silver) B 1 2 1 (Diamond) C 3 5 3 (Silver) D 5 3 4 (Bronze) E 7 2 2 (Gold)    Draw a Gantt chart showing First-Come-First-Served (FCFS) scheduling for these jobs.       Draw a Gantt chart showing preemptive PRIORITY scheduling. Draw a Gantt chart showing Highest Response Ratio Next (HRRN) scheduling.     Draw a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT