html5-img
1 / 18

Operating Systems Lecture 19 Scheduling IV

Operating Systems Lecture 19 Scheduling IV. 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

shania
Download Presentation

Operating Systems Lecture 19 Scheduling IV

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Operating SystemsLecture 19 Scheduling IV Operating System Concepts

  2. 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 – RRbackground – 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. Operating System Concepts

  3. Multilevel Queue scheduling Operating System Concepts

  4. 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) Operating System Concepts

  5. 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. Operating System Concepts

  6. Example of a Multilevel Feedback Queue • Three queues: • Q0 – time quantum 8 milliseconds • Q1 – time quantum 16 milliseconds • Q2 – FCFS • Scheduling • A new job enters queue Q0which is servedFCFS. When it gains CPU, job receives 8 milliseconds. If it does not finish in 8 milliseconds, job is moved to queue Q1. • At Q1 job is again served FCFS and receives 16 additional milliseconds. If it still does not complete, it is preempted and moved to queue Q2. Operating System Concepts

  7. Multilevel Feedback Queues Operating System Concepts

  8. 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. Operating System Concepts

  9. 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. Operating System Concepts

  10. 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 Operating System Concepts

  11. 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. Operating System Concepts

  12. Example of Deterministic Modeling ProcessBurst Time P1 10 P2 29 P3 3 P4 7 P5 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). Operating System Concepts

  13. 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). Operating System Concepts

  14. 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. Operating System Concepts

  15. 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 = l W where: n = the average queue length W = the average wait time l = the average arrival rate of processes If one knows two of the above variables, one can compute the third. Operating System Concepts

  16. 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. Operating System Concepts

  17. 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. Operating System Concepts

  18. 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. Operating System Concepts

More Related