1 / 32

CPU Scheduling

Learn about the basic concepts of CPU scheduling, different scheduling criteria, algorithms, multiple-processor scheduling, and real-time scheduling in operating systems.

deddie
Download Presentation

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. CPU Scheduling Peng Lu

  2. CPU Scheduling • 1. Basic Concepts • 2. Scheduling Criteria • 3. Scheduling Algorithms • 4. Multiple-Processor Scheduling • 5. Real-Time Scheduling

  3. 1. Basic Concepts • Alternating Sequence of CPU And I/O Bursts • CPU Scheduler • Preemptive Scheduling • Dispatcher

  4. Alternating Sequence of CPU And I/O Bursts

  5. Histogram of CPU-burst Times

  6. CPU Scheduler • Short-term scheduler • First-in, first-out (FIFO)

  7. Preemptive Scheduling • CPU scheduling decisions may take place when a process: 1.Switches from running to waiting state 2. Switches from running to ready state 3. Switches from waiting to ready state 4. Terminates • Non-preemptive (1 and 4) • Preemptive (All other)

  8. Dispatcher • Dispatcher involves: • switching context • switching to user mode • jumping to the proper location in the user program to restart that program • Dispatch latency

  9. 2. Scheduling Criteria • CPU utilization • Throughput • Turnaround time • Waiting time • Response time

  10. Optimization Criteria • Max CPU utilization • Max throughput • Min turnaround time • Min waiting time • Min response time

  11. 3. Scheduling Algorithms • First-come, First-served (FCFS) • Shortest-Job-First (SJF) • Priority • Round-Robin (RR) • Multilevel Queue • Multilevel Feedback Queue

  12. P1 P2 P3 0 24 27 30 First-Come, First-Served (FCFS) ProcessBurst Time P1 24 P23 P3 3 • If that the processes arrive in the order: P1 , P2 , P3 ,,The Gantt Chart for the schedule is:

  13. P2 P3 P1 0 3 6 30 FCFS Scheduling (Cont.) If that the processes arrive in the order P2 , P3 , P1 • The Gantt chart for the schedule is:

  14. Shortest-Job-First (SJF) ProcessBurst Time P1 6 P2 8 P3 7 P4 3

  15. Prediction of the Length of the Next CPU Burst

  16. Priority Scheduling ProcessBurst TimePriority P1 10 3 P2 1 1 P3 2 4 P4 1 5 P5 5 2

  17. Priority Scheduling • Indefinite blocking (Starvation) • Aging

  18. P1 P2 P3 P4 P1 P3 P4 P1 P3 P3 0 20 37 57 77 97 117 121 134 154 162 Round-Robin (RR) Time Quantum = 20 ProcessBurst Time P1 53 P217 P368 P424

  19. Time Quantum and Context Switch Time

  20. Turnaround Time Varies With The Time Quantum

  21. Multilevel Queue

  22. Multilevel Feedback Queues

  23. 4. Multiple-Processor Scheduling • More complex when multiple CPUs are available • Homogeneous • Load sharing • Asymmetric multiprocessing

  24. 5. Real-Time Scheduling • Hard real-time • Soft real-time

  25. Summary • Optimization Criteria • Max CPU utilization, throughput; • Min turnaround, waiting and response time • FCFS, SJF, Priority, RR • Multilevel Queue and Feedback Queue

  26. 6. Algorithm Evaluation • Deterministic modeling • Queueing models • Simulations • Implementation

  27. Operating System Examples • Solaris scheduling • Windows XP scheduling • Linux scheduling

  28. Operating System Examples:Solaris 2 Scheduling

  29. Solaris Dispatch Table

  30. Operating System Examples:Windows XP

  31. Operating System Examples:Linux Scheduling • Time-sharing • Real-time

  32. The Relationship Between Priorities and Time-slice length

More Related