1 / 14

Cs238 CPU Scheduling

Cs238 CPU Scheduling. Dr. Alan R. Davis. CPU Scheduling. The objective of multiprogramming is to have some process running at all times, to maximize CPU utilization. A process is executed until it must wait, usually for completion of some I/O request.

Télécharger la présentation

Cs238 CPU Scheduling

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. Cs238 CPU Scheduling Dr. Alan R. Davis

  2. CPU Scheduling • The objective of multiprogramming is to have some process running at all times, to maximize CPU utilization. • A process is executed until it must wait, usually for completion of some I/O request. • The OS then switches the process with another ready process which can use the CPU. • Processes alternate between CPU bursts and I/O bursts.

  3. Scheduling AlgorithmsWhat criteria should be used? • CPU Utilization: keep the CPU as busy as possible • Throughput: maximize the number of processes completed per unit of time • Turnaround time: minimize the time interval between submission and completion of processes • Waiting time: minimize the time a process remains in the waiting queue • Response time: minimize the time between submission of a process and the first response

  4. Scheduling Algorithms First-come, First-served (FCFS) • Works as its name implies. • Example (Process, Burst Time): (P1, 24), (P2, 3), (P3, 3) • If they arrive in the order P1, P2, P3, then the average waiting time is (0 + 24 + 27)/3 = 17 • If they arrive in the order P2, P3, P1, then the average waiting time is (6 + 0 + 3)/3 = 3

  5. Scheduling Algorithms Shortest-Job-First (SJF) • Choose the job with the next shortest CPU burst • Example (Process, Burst Time): (P1, 6), (P2, 8), (P3, 7), (P4, 3) • They are processed in the order P4, P1, P3, P2 then the average waiting time is (3 + 16 + 9 + 0)/4 = 7

  6. Scheduling Algorithms Priority Scheduling • Associate a priority with each process, and schedule the process with the highest priority next. • Equal priority processes can be scheduled FCFS. • SJF is priority scheduling with shorter jobs having higher priority. • Example (Process, Burst Time, Priority): (P1, 10, 3), (P2, 1, 1), (P3, 2, 3), (P4, 1, 4), (P5, 5, 2) • They are processed in the order P2, P5, P1, P3, P4 then the average waiting time is (6 + 0 + 16 + 18 + 1)/5 = 8.2

  7. Scheduling Algorithms Round-Robin (RR) • A fixed time quantum is chosen, then each process is given the CPU for that amount of time, then placed at the end of the queue if necessary.

  8. Scheduling Algorithms Multilevel Queue Scheduling • For example, create queues for • 1. System processes • 2. Interactive processes • 3. Interactive editing processes • 4. Batch processes • 5. Student processes

  9. Scheduling Algorithms Multilevel Feedback Queues • Allows a process to move between queues

  10. Multiple-Processor Scheduling • Load sharing schedules processes among several identical processors. • Each processor could have its own ready queue, but then some processors must be idle. • The processors could share a single ready queue. • One processor could be appointed as the scheduler for all of them (asymmetric multiprocessing).

  11. Real-Time Scheduling • Hard real-time systems are required to complete a critical task within a guaranteed amount of time. • The scheduler must then know that time requirement for each process. • It then either accepts or rejects the process if it can’t meet the requirement. • If the system has secondary storage or virtual memory, the scheduler can not know how long the process will take.

  12. Real-Time Scheduling • A soft real-time system requires that critical processes receive priority over less important ones. • The system must have priority scheduling. • Steps must be taken to prevent starvation of less important processes. • Priority of real-time processes must not degrade over time.

  13. Real-Time Scheduling Dispatch Latency • Dispatch latency must be low. • System calls must be preemptible. • Preemption points can be inserted into long duration system calls, so that a ready high priority process can be detected. • Or we could make the entire kernel preemptible. We would need to make all kernel data structures protected through various synchronization mechanisms.

  14. Algorithm Evaluation • Choose the important criteria, then evaluate the various algorithms under consideration. • Deterministic modeling: calculate the cost of each algorithm on a given set of input data • Queuing models: measure the distribution of CPU and I/O bursts, as well as the arrival times of processes, and use formulas and concepts of queuing-network theory to calculate other quantities • Simulations: program a model of the computer system, generate test data randomly • Implementation: code all the algorithms, include them in the OS, and test under real conditions

More Related