1 / 46

Process Scheduling

Chapter 4. Process Scheduling. A schematic of scheduling. Scheduling-related Concepts and Terms. Kinds of Scheduling . Non-preemptive scheduling: A process runs to completion when scheduled

angie
Download Presentation

Process 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. Chapter 4 Process Scheduling

  2. A schematic of scheduling

  3. Scheduling-related Concepts and Terms

  4. Kinds of Scheduling • Non-preemptive scheduling: A process runs to completion when scheduled • Preemptive scheduling: A process may be preempted by the kernel, and another process may be scheduled. Hence a set of processes are processed in an overlapped manner.

  5. Processes for scheduling

  6. Non-preemptive scheduling • Performance criteria: • Throughput • Turnaround times of processes • Weighted turnaround • Change the order in which processes are serviced • Non-preemptive scheduling policies: - First come first served (FCFS) - Shortest request first Q: Which policy will provide better throughput under what conditions?

  7. Scheduling using FCFS and SRN policies

  8. Performance of FCFS and SRN scheduling

  9. Preemptive scheduling policies • Performance criteria: • Throughput • Response time to a subrequest • Scheduling policies • Round-robin with time slicing (RR) • Least completed next (LCN) • Shortest time to go (STG): shortest remaining time • Highest response ratio (HRN): defined later

  10. Round-robin with time slicing (RR)

  11. Least completed next (LCN)

  12. Shortest time to go (STG)

  13. Scheduling using preemptive scheduling policies

  14. Operation of preemptive scheduling policies

  15. Performance of preemptive scheduling policies

  16. Variation of average response time with time slice

  17. Highest response ratio next (HRN) • Two ways of defining response ratio of a process • Response ratio = Time in the system / service time recd • Response ratio = (Time in the system + execution time)/ service time received We use the first definition in the next slide HRN eliminates the drawbacks of LCN and STG policies. Q: How?

  18. Performance of HRN scheduling policy

  19. Long, medium and short-term scheduling

  20. Event handling and scheduling

  21. Long, medium and short-term scheduling in a time sharing system

  22. Mechanism and policy modules of process scheduler

  23. Simple priority-based scheduling

  24. Priority-based scheduling

  25. Priority-based scheduling • What should the kernel do if there aren’t any ready processes? • Schedule a dummy process that does nothing • Put the processor to sleep (conserves power!)

  26. Round-robin scheduling

  27. Ready lists in a time sharing system

  28. Practical scheduling policies • Provide a good balance of response time and overhead • Vary the time slice! • Vary the priority • Provide fair service to processes (Q: How defined?) • In round-robin, all process receive approx similar service. What if one application has 5 processes, while another application has only 1 process?

  29. Multilevel scheduling

  30. Ready lists in a multilevel scheduler

  31. Multi-level adaptive scheduling • Vary the priority of a process depending on its recent behaviour • If the process uses up its time slice, it must be (more) CPU bound than assumed, so reduce its priority • If a process is starved of CPU attention for some time, increase its priority

  32. Example of multi-level adaptive scheduling

  33. Fair share scheduling

  34. Scheduling in Unix • Processes are assigned priorities that are integer values • A larger value implies a lower priority • Priority of a process is varied based on its CPU usage • So as not to have an LCN-like effect (starvation!), the effect of CPU time used is decays with time, hence only recent CPU usage affects priority of a process • Priority of a process = Base priority + nice value + f(CPU time used by the process

  35. Operation of a Unix-like scheduling policy when process perform I/O

  36. Fair-share scheduling using a Unix-like policy • Groups of processes are defined for ensuring fair share of CPU time • Priority of a process depends on the CPU time used by all processes its group • Priority of a process = Base priority + nice value + f(CPU time used by the process) + f(CPU time used by all processes in the same group)

  37. Operation of a fair share scheduling

  38. Real time scheduling • Perform scheduling such that each process can meet its deadline • Procedure: • Consider precedences between processes, i.e. which process should complete before which other process • Find the deadline of each application • Use a scheduling policy which ensures that deadlines are met (in a soft real time system, it is adequate to try to meet the deadlines, and succeed most of the time)

  39. Real time scheduling

  40. Process precedence graph (PPG)for a simple real time system

  41. Deadlines for processes of previous slide • Total execution time = 25 seconds • If the deadline for the application as a whole is 35 seconds • process P6 has a deadline of 35 seconds • processes P4 and P5 have deadlines of 30 seconds Q: What are the deadlines of other processes?

  42. Feasible schedule • An application has a feasible schedule if there exists at least one sequence in which its processes can be scheduled so that deadlines of all processes are met • Justify the following statement: “If a feasible schedule exists for an application, then earliest deadline first (EDF) scheduling can meet all deadlines.”

  43. Performance of Earliest Deadline First Scheduling

  44. Rate Monotonic Scheduling (RMS) • Priority of a process is inversely proportional to its periodicity • Priority-based scheduling is now used Q: Does RMS guarantee that deadlines will be met if an application has a feasible schedule?

  45. Rate Monotonic Scheduling (RMS) • Consider three processes: P1 P2 P3 Time period 10 15 30 Execution time 3 5 9 • What are their priorities? • Does a feasible schedule exist? • Consider summation of (execution time/time period) • Feasible schedule exists if summation is < 1. • Will RMS find a feasible schedule?

  46. Summary of performance analysis

More Related