1 / 122

Final topics: Scheduling Recap and some advanced topics

Final topics: Scheduling Recap and some advanced topics. CPU Scheduling. CPU Scheduling The act of determining which process in the ready state should be moved to the running state Many processes may be in the ready state

leia
Télécharger la présentation

Final topics: Scheduling Recap and some advanced topics

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. Final topics: Scheduling Recapand some advancedtopics

  2. CPU Scheduling CPU Scheduling The act of determining which process in the ready state should be moved to the running state • Many processes may be in the ready state • Only one process can be in the running state, making progress at any one time Which one gets to move from ready to running?

  3. CPU Scheduling Nonpreemptive scheduling The currently executing process gives up the CPU voluntarily Preemptive scheduling The operating system decides to favor another process, preempting the currently executing process Turnaround time The amount of time between when a process arrives in the ready state the first time and when it exits the running state for the last time

  4. CPU Scheduling Algorithms First-Come, First-Served Processes are moved to the CPU in the order in which they arrive in the running state Shortest Job Next Process with shortest estimated running time in the ready state is moved into the running state first Round Robin Each process runs for a specified time slice and moves from the running state to the ready state to await its next turn if not finished

  5. First-Come, First-Served Average Turnaround: (140 + 215 + 535 + 815 + 940)/5

  6. Shortest Job Next Average Turnaround: (75 + 200 + 340 + 620 + 940)/5

  7. Round Robin Every process is treated the same! Time slice (quantum) The amount of time each process receives before being preempted and returned to the ready state to allow another process its turn

  8. Round Robin Suppose the time slice is 50 Average turnaround: (515 + 325 + 940 + 920 + 640)/5

  9. CPU Scheduling Algorithms Are these scheduling algorithms preemptive or non-preemptive? Explain First-Come, First-Served? Shortest Job Next? Round Robin?

  10. First-Come, First-Served 0 

  11. First-Come, First-Served 0 p1 

  12. First-Come, First-Served 0 40 p1 

  13. First-Come, First-Served 0 50 p1 

  14. First-Come, First-Served 0 140 p1 

  15. First-Come, First-Served 0 140 p1 

  16. First-Come, First-Served 0 140 p1 p2 

  17. First-Come, First-Served 0 140 215 p1 p2 

  18. First-Come, First-Served 0 140 215 p1 p2 

  19. First-Come, First-Served 0 140 215 p1 p2 p3 

  20. First-Come, First-Served 0 140 215 300 p1 p2 p3 

  21. First-Come, First-Served 0 140 215 315 p1 p2 p3 

  22. First-Come, First-Served 0 140 215 535 p1 p2 p3 

  23. First-Come, First-Served 0 140 215 535 p1 p2 p3 

  24. First-Come, First-Served 0 140 215 535 815 p1 p2 p3 p4 

  25. First-Come, First-Served 0 140 215 535 815 p1 p2 p3 p4 

  26. First-Come, First-Served 0 140 215 535 815 p1 p2 p3 p4 p5 

  27. First-Come, First-Served 0 140 215 535 815 940 p1 p2 p3 p4 p5 

  28. First-Come, First-Served 0 140 215 535 815 940 p1 p2 p3 p4 p5 Average Turnaround time: 388 

  29. Shortest Job Next (SJN) • When choosing next job to run, look at all processes in the ready state and dispatch the one with the smallest service time. • (assuming we know the service times!) • We consider it as a nonpreemptive algorithm. That is a new job will not be given a chance at the CPU until the current job finishes (even if new job is shorter).

  30. Shortest Job Next Average Turnaround time: 435 Page 337

  31. Shortest Job Next 0 

  32. Shortest Job Next 0 p1 

  33. Shortest Job Next 0 40 p1 

  34. Shortest Job Next 0 50 p1 

  35. Shortest Job Next 0 140 p1 

  36. Shortest Job Next 0 140 p1 

  37. Shortest Job Next 0 140 p1 p2 

  38. Shortest Job Next 0 140 215 p1 p2 

  39. Shortest Job Next 0 140 215 p1 p2 

  40. Shortest Job Next 0 140 215 p1 p2 p3 

  41. Shortest Job Next 0 140 215 300 p1 p2 p3 

  42. Shortest Job Next 0 140 215 315 p1 p2 p3 

  43. Shortest Job Next 0 140 215 535 p1 p2 p3 

  44. Shortest Job Next 0 140 215 535 p1 p2 p3 

  45. Shortest Job Next 0 140 215 535 p1 p2 p3 p5 

  46. Shortest Job Next 0 140 215 535 660 p1 p2 p3 p5 

  47. Shortest Job Next 0 140 215 535 660 p1 p2 p3 p5 

  48. Shortest Job Next 0 140 215 535 660 p1 p2 p3 p5 p4 

  49. Shortest Job Next 0 140 215 535 660 940 p1 p2 p3 p5 p4 

  50. Shortest Job Next 0 140 215 535 660 940 p1 p2 p3 p5 p4 Average Turnaround time: 357

More Related