Question

In the videos we show that Shortest Job First is the best algorithm with respect to...

  1. In the videos we show that Shortest Job First is the best algorithm with respect to average turn around time when there is no Input Output (I/O) burst. When there is I/O bust we have three variants:
  1. Shortest remaining burst time first (SRBTF)
  2. Shortest next burst time first (SNBTF)
  3. Shortest total burst time first (STBTF)

Does SRBTF have the least average turnaround time? If Yes prove it in explanation, If no give an example schedule which is not SRBTF but has lower turnaround time.

Does SNBTF have the least average turnaround time? If Yes prove it in explanation, If no give an example schedule which is not SNBTF but has lower turnaround time.

Does STBTF have the least average turnaround time? If Yes prove it in explanation, If no give an example schedule which is not STBTF but has lower turnaround time.

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

SRBTF have the least Average turn around time compare to SNBTF, STBTF

SRBTF(Shortest Remaining Burst Time First) :

  • In this algorithm, the process that has the shortest CPU burst time is selected first for the execution.
  • When the CPU is available it is assign to the process that has the smallest next CPU burst.
  • If two processes have the same length of CPU burst then FCFS policy is used to solve the tie.
  • In fact more appropriate term for this algorithm would be the “Next Shortest CPU Burst Time First” because it allocates the CPU by examining the length of the next CPU burst of a process rather than its total length of a burst time.
  • SJF algorithm may be either preemptive or non-preemptive.
  • When a new process arrives having a short CPU burst time than the currently executing process; preemptive SJF algorithm will preempt the currently executing process, and allocates the CPU to the newly arrived process where as a non-preemptive SJF algorithm will allow the current running process to finish its CPU burst,

Example:

Consider the following processes and their CPU burst time (in millis.) and find out average waiting time and average turnaround time using preemptive SJF technique.

Process

Burst Time (ms.)

Arrival Time

P1

9 0

P2

4 1
P3 5

2

P4

7

3

P5 3

4

Total

28

  • Notice that all processes arrives at different time period so we also need to consider their arrival time while finding shortest CPU burst from the available processes.
  • So if we look to the arrival order of processes, P1 is the first process as its arrival time is zero. At zero millisecond we have only one process available in ready queue i.e. P1 so obviously process P1 will get the CPU first as we have no choice for comparison.
  • After one millisecond a new process enter into the ready queue i.e process P2 with burst time of 4 milliseconds. The execution of currently running process P1 is completed of about one milliseconds when new process P2 arrives. so now we have total two processes into the ready queue for selection based on shortest CPU burst time.
  • After one millisecond the burst time of process P1 is 8 (9-1 millis.) and process P2 with burst time 4. Since P2 has shortest CPU burst time, execution of currently running process P1 will be stopped by deallocating the CPU from P1 and P2 will be selected for execution by allocating the CPU to it.
  • Similarly, at the time of two milliseconds, another new process P3 with burst time of 5 milliseconds arrives into the ready queue. Current execution of P2 is one milliseconds and remaining burst time is 3 milliseconds (4-1).
  • Now we have total three processes into the ready queue so again their burst time will be compared and process having shortest burst time will be selected. In our case remaining burst time of process P1 is 8, P2 has 3 and P3 with 5 milliseconds respectively. Process P2 will continue to execute as it has the shortest burst time.
  • In similar fashion, whenever a new process arrives, their burst time will be compared to find out process with the minimum burst time for selection.
Turnaround Time = Total Turnaround Time- Arrival Time 

P1 = 28 – 0 =28 ms,

P2 = 5 – 1 = 4,

P3 = 13 – 2 = 11,

P4 = 20 – 3 = 17,

P5 = 8 – 4 = 4

Total Turnaround Time= 64 mills.
Avg. Turnaround Time  = Total Turnaround Time / No.of Process
= 64 / 5

= 12.8 mills. 

The average turn around time for SNBTF is : 13.8 mills

The average turn around time for STBTF is : 14.2 mils

Add a comment
Know the answer?
Add Answer to:
In the videos we show that Shortest Job First is the best algorithm with respect to...
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
  • Question 3 (20%) In this course we elaborated the Dijkstra algorithm for finding the shortest paths...

    Question 3 (20%) In this course we elaborated the Dijkstra algorithm for finding the shortest paths from one vertex to the other vertices in a graph. However, this algorithm has one restriction; It does not work for the graphs that have negative weight edges. For this question you need to search and find an algorithm for finding the shortest paths from one vertex to all the other vertices in a graph with negative weight edges. You need to explain step...

  • This assignment requires you to create simulations for different scheduling algorithms commonly employed by operating systems...

    This assignment requires you to create simulations for different scheduling algorithms commonly employed by operating systems to achieve multiprogramming. All problems in this assignment assume the following: The simulations you will be creating are for a uniprocessor system (single CPU). Processes in these simulations will require CPU bursts of one or more time units followed by I/O bursts of one or more time units. For simplicity’s sake, when more than one process is executing its I/O burst at the same...

  • Problem 2: As we discussed in class, one can use an algorithm for computing all-pairs shortest...

    Problem 2: As we discussed in class, one can use an algorithm for computing all-pairs shortest paths to also compute the transitive closure of a graph. If using Floyd-Warshall for example, it is possible to do this in On") time (where as usual n is the number of nodes and m is the number of edges). Show how to compute the transitive closure of a directed graph in O(nm) time. For which type of graphs is this better than using...

  • Assume a dynamic queue which is serviced by a Priority Based Round Robin algorithm such that ther...

    Assume a dynamic queue which is serviced by a Priority Based Round Robin algorithm such that there exists three priorities (1,2,3) which are used as multipliers of the basic time quantum value with the resulting number being the maximum service time the corresponding job will receive each time it gets the CPU. For a maximum amount of time equal to 1 basic time quantum , a priority 2 job gets the CPU for the maximum amount of time equal to...

  • Assume that you have four different processes with the following attributes: Process   Arrival time.   CPU Burst....

    Assume that you have four different processes with the following attributes: Process   Arrival time.   CPU Burst.   I/O Burst Total CPU time A. 0 4 4 9 B 3 2 3 7 C 6 5 1 11 D 12 1 1 5 As we did in class, perform a scheduling simulation using these four processes according to the following algorithms: 1) First Come First Serve 2) Round Robin with time slice = 1 3) Round Robin with time slice = 3...

  • Problem 6. (Weighted Graph Reduction) Your friend has written an algorithm which solves the all pairs shortest path pr...

    Problem 6. (Weighted Graph Reduction) Your friend has written an algorithm which solves the all pairs shortest path problem for unweighted undirected graphs. The cost of a path in this setting is the number of edges in the path. The algorithm UNWEIGHTEDAPSP takes the following input and output: UNWEİGHTEDA PSP Input: An unweighted undirected graph G Output: The costs of the shortest paths between each pair of vertices fu, v) For example, consider the following graph G. The output of...

  • 4.11.3 P4.11.3 Prove the claim at the end of the section about the Euclidean Algorithm and...

    4.11.3 P4.11.3 Prove the claim at the end of the section about the Euclidean Algorithm and Fibonaci numbers. Specifically, prove that if positive naturals a and b are each at most F(n), then the Euclidean Algorithm performs at most n -2 divisions. (You may assume that n >2) P4.11.4 Suppose we want to lay out a full undirected binary tree on an integrated circuit chip, wi 4.11.3 The Speed of the Euclidean Algorithm Here is a final problem from number...

  • In this question, we will think about how to answer shortest path problems where we have more than just a single sourc...

    In this question, we will think about how to answer shortest path problems where we have more than just a single source and destination. Answer each of the following in English (not code or pseudocode). Each subpart requires at most a few sentences to answer. Answers significantly longer than required will not receive full credit You are in charge of routing ambulances to emergency calls. You have k ambulances in your fleet that are parked at different locations, and you...

  • Suppose we choose the element in the middle position of the array as pivot. (a) Does...

    Suppose we choose the element in the middle position of the array as pivot. (a) Does this make it unlikely that quicksort will require quadratic time? (b) Does it reduce the average running time for random input? Answer YES or NO to each question. Do not give any explanation or description. (a) (b) A sorting algorithm is stable if elements with the same value are left in the same order as they occur in the input. Which of the sorting...

  • In this question, we will think about how to answer shortest path problems where we have more than just a single sourc...

    In this question, we will think about how to answer shortest path problems where we have more than just a single source and destination. Answer each of the following in English (not code or pseudocode). Each subpart requires at most a few sentences to answer. Answers significantly longer than required will not receive full credit You are in charge of routing ambulances to emergency calls. You have k ambulances in your fleet that are parked at different locations, and you...

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