Question

In: Computer Science

Assume you have the following jobs to execute with one processor: i t(pi) Priority 0 80...

  1. Assume you have the following jobs to execute with one processor:
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:

  1. Create a Gantt chart illustrating the execution of these processes.
  2. What is the turnaround time for process p1?
  3. What is the average wait time for the processes?

Solutions

Expert Solution

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!


Related Solutions

Assume you have the following jobs to execute with one processor: i t(pi) Arrival Time 0...
Assume you have the following jobs to execute with one processor: i t(pi) Arrival Time 0 75 0 1 40 10 2 25 10 3 20 80 4 45 85 Using the table, assume the context switch time is five time units with RR scheduling. Create a Gantt chart illustrating the execution of these processes. What is the turnaround time for process p3? What is the average wait time for the processes?
Assume you have the following jobs to execute with one processor, with the jobs arriving in the order listed above.
i t(pi) 0 80 1 20 2 10 3 20 4 50 Assume you have the following jobs to execute with one processor, with the jobs arriving in the order listed above. Suppose a system uses FCFS scheduling. Create a Gantt chart illustrating the execution of these processes . b   What is the turnaround time for process p3? c.   What is the average wait time for the processes? Using the process load above, suppose a system uses SJN scheduling. d...
One period of a real-time signal x(t) =2Sin(20*pi*t) , starting at t=0, has to be processed...
One period of a real-time signal x(t) =2Sin(20*pi*t) , starting at t=0, has to be processed in a 4-bit digital computer. The A/D card have a sampling frequency of 55Hz and the input range is +/- 2Volts. i) What are the values recorded in the sampled signal x[n] ? ii)What is the resulting quantized signal? iii)What is the resulting digitized/coded signal? iv)If the sampled signal x[n] was filtered using a moving average filter of length 3 , what would the...
i need the graph also please . Consider the following jobs having I/0 wait of 70%...
i need the graph also please . Consider the following jobs having I/0 wait of 70% with Arrival time and CPU minutes needed.         Jobs Arrival Time CPU minutes needed 1 13:10 8 2 13:30 6 3 13:40 4 4 13:50 4 5 13:55 3 1. Calculate CPU idle, CPU busy and CPU busy/ process 2. Draw a graph showing no. of jobs and when it completes
Consider the following fragment of C code: for (i=0; i<100; i++) { A[i]=B[i]+C; } Assume that...
Consider the following fragment of C code: for (i=0; i<100; i++) { A[i]=B[i]+C; } Assume that A and B are arrays of 64-bit integers, and C and i are 64-bit integers. Assume that all data values and their addresses are kept in memory (at addresses 1000, 3000, 5000, and 7000 for A, B, C, and i, respectively) except when they are operated on. Assume that values in registers are lost between iterations of the loop. Assume all addresses and words...
Assume you have two processes, P1 and P2. P1 has a high priority, P2 has a...
Assume you have two processes, P1 and P2. P1 has a high priority, P2 has a low priority. P1 and P2 have one shared semaphore (i.e., they both carry out waits and posts on the same semaphore). The processes can be interleaved in any arbitrary order (e.g. P2 could be started before P1).             i.             Explain the problem with priority inversion Briefly explain whether the processes could deadlock when:            ii. both processes run on a Linux system as...
Assume you have a variable, budget, that is associated with a positive integer. Assume you have another variable, shopping_list, that is a tuple of strings representing items to purchase in order of priority.
Assume you have a variable, budget, that is associated with a positive integer. Assume you have another variable, shopping_list, that is a tuple of strings representing items to purchase in order of priority. (For example: ("codelab", "textbook", "ipod", "cd", "bike")) Furthermore, assume you have a variable, prices that is a dictionary that maps items (strings such as those in your shopping_list) to positive integers that are the prices of the items. Write the necessary code to determine the number of...
I have a transfer function T(S)=.023/(.02913S^3+.1543s^2+.1205S). I need to design a PI, PD, or PID controller...
I have a transfer function T(S)=.023/(.02913S^3+.1543s^2+.1205S). I need to design a PI, PD, or PID controller to give this system a peak overshoot PO of 15% and a rising time Tr of 3 seconds. I have equations that relate the characteristic equation to the PO and Tr, but that only works for a second order equation.
Assume that you have a set of jobs where each has only a processing time that...
Assume that you have a set of jobs where each has only a processing time that you need to schedule on a single machine. Explain how you should schedule the jobs to minimize the sum of completion (finish) times. Write a proof that your schedule is optimal.
(1)   What do you assume the entropy S for a perfect crystal when T = 0?...
(1)   What do you assume the entropy S for a perfect crystal when T = 0? (2)   Is the S(0) still zero if the crystal is not perfect? Why? (3)   How to calculate dS when under the constant pressure and cp is given? (4)   How to calculate the entropy of H2O at 500 K? (5)   How to calculate the entropy change for a chemical reaction if you can find the S for each chemical? (6)   For an isolated thermodynamic system,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT