Download presentation

Presentation is loading. Please wait.

Published byKelly Hampton Modified over 5 years ago

1
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.1 Operating System Concepts Operating Systems Lecture 19 Scheduling IV

2
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.2 Operating System Concepts Multilevel Queues Ready queue is partitioned into separate queues: E.g.: foreground (interactive) background (batch) Each queue has its own scheduling algorithm, e.g.: foreground – RR background – FCFS Scheduling must be done between the queues. Possible methods: Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation. Time slice – each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 80% to foreground in RR 20% to background in FCFS Works well for time sharing systems.

3
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.3 Operating System Concepts Multilevel Queue scheduling

4
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.4 Operating System Concepts Multilevel Feedback Queue A process can move between the various queues; aging can be implemented this way. Multilevel-feedback-queue scheduler defined by the following parameters: number of queues scheduling algorithms for each queue method used to determine when to upgrade a process method used to determine when to demote a process method used to determine which queue a process will enter when that process needs service (where to put new processes)

5
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.5 Operating System Concepts Typical behavior for multilevel feedback queues New processes go to the highest priority queue for that job type. Top priorities reserved for system processes. If process uses full time slice, it moves down a priority. If process blocks before using full time slice, it remains at the same priority. Higher priority queues have smaller time slices than lower priority queues.

6
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.6 Operating System Concepts Example of a Multilevel Feedback Queue Three queues: Q 0 – time quantum 8 milliseconds Q 1 – time quantum 16 milliseconds Q 2 – FCFS Scheduling A new job enters queue Q 0 which is served FCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q 1. At Q 1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q 2.

7
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.7 Operating System Concepts Multilevel Feedback Queues

8
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.8 Operating System Concepts Notes on Multilevel Feedback Queues Short processes are favored. Good for interactive processes with short CPU bursts. Is starvation Possible? Yes--Long processes may wait forever. To avoid--increase the priority of a process if it has been waiting for some period of time in some queue.

9
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.9 Operating System Concepts Scheduling Multiple Processors Scheduling for multiple processors is more complex than for a single process. Identical processors: Accomplish load sharing between processes Use a single ready queue. (Question: Why not a queue for each processor?) Scheduling methods Each processor is self scheduling. (Requires careful programming). One processor is scheduler for all the other processors. One processor does all scheduling, I/O and system activities. Other processors only execute user code. This is asymmetric multiprocessing. Asymmetric multiprocessing is easier to program, but less efficient than symmetric processing.

10
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.10 Operating System Concepts Algorithm Evaluation How do we choose a scheduling algorithm? First, choose the criteria you want to use to judge the algorithm. E.g. Maximize the CPU utilization under the constraint that the maximum response time is 1 second. Maximize throughput such that turnaround time is on average linearly proportional to total execution time. Next, evaluate the algorithms under consideration. Methods of evaluation: Analytic evaluation (Deterministic modeling) Queueing models Simulations Implementation

11
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.11 Operating System Concepts Deterministic Modeling Analytic Evaluation is a method in which a given algorithm and system workload are used to produce a formula or number that evaluates the performance of the algorithm for that particular workload. Deterministic modeling is one type of analytic evaluation.

12
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.12 Operating System Concepts Example of Deterministic Modeling ProcessBurst Time P 1 10 P 2 29 P3 3 P3 3 P 4 7 P 5 12 Compute the average wait time for FCFS, SJF and RR (quantum = 10 msec) Which algorithm gives the minimum wait time? FCFS: 28 msec SJF: 13 msec RR: 23 msec SJF gives the shortest wait time (as expected, since it is optimal for shortest wait time).

13
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.13 Operating System Concepts Pros and Cons of Deterministic Modeling Advantages of deterministic modeling Simple and fast Gives an exact number Makes it easy to compare algorithms Disadvantages: Requires exact numbers for input. Answers only apply to the specific case tested. Does not give a general answer (too specific).

14
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.14 Operating System Concepts Queueing Models Network queueing analysis models the system as a set of servers with associated queues of waiting processes: CPU and ready queue I/O system and device queues etc. This method uses information about the distribution of CPU and I/O bursts (determined by measurement or estimation). The distribution is used to obtain a formula for the probability of a particular CPU burst length. The method also requires a distribution of process arrival times (either measured or estimated). Using the above information, queueing analysis can be used to compute CPU utilization, average queue length, average wait time, etc.

15
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.15 Operating System Concepts Little's Formula At steady state, the same number of processes are arriving in a queue as are leaving the queue. In this case, Little's formula applies: n = W where: n = the average queue length W = the average wait time = the average arrival rate of processes If one knows two of the above variables, one can compute the third.

16
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.16 Operating System Concepts Limitations of Queueing analysis There are limited classes of algorithms and distributions that can be handled by queueing analysis. Mathematics can be difficult to work with. Distributions are often defined in mathematically tractable ways that are unrealistic. To work with the mathematics, inaccurate assumptions may be made. The theory therefore only yields approximate answers.

17
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.17 Operating System Concepts Simulations Simulations are programs that models the components of the computer system. Software data structures represent system components (e.g. a variable is used to represent the system clock). The simulator modifies the system state to reflect the activities of the devices, scheduler and processes. The simulator keeps track of statistics about system performance. Input data (arrival times and burst times) can be generated by either: A random number generator A trace tape (a record of arrival and burst times on an actual system). Drawbacks of simulation: Simulation is very expensive. It can take hours of computing time. More detail yields more accurate results, but takes more time to compute. Trace tapes may need a large amount of storage space.

18
Silberschatz, Galvin and Gagne 2002 Modified for CSCI 399, Royden, 2005 6.18 Operating System Concepts Implementation The most accurate way to measure performance is to implement the algorithm and run it. Drawbacks: Expensive--Coding the algorithm and modifying the O.S. to support it can take many hours of programming. The environment in which the algorithm is used may change, so that the initial results no longer apply. Flexible scheduling algorithms can be altered by the system manager or users to accommodate changes in the environment.

Similar presentations

© 2020 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google