120 likes | 249 Views
Lecture 11 Uniprocessor Scheduling. Types of Scheduling. Long-term performed when new process is created Medium-term Swap-in, swap-out processes to/from main memory Short-term which ready process to execute next. Short-term Scheduling Criteria User-oriented. Response Time
E N D
Lecture 11Uniprocessor Scheduling M.B. Ibáñez
Types of Scheduling • Long-term • performed when new process is created • Medium-term • Swap-in, swap-out processes to/from main memory • Short-term • which ready process to execute next M.B. Ibáñez
Short-term Scheduling CriteriaUser-oriented • Response Time • Elapsed time between the submission of a request until there is output. • Turnaround time • How long it takes to execute a process M.B. Ibáñez
Short-term Scheduling Criteria System-oriented • CPU utilization • We want to keep the CPU as busy as possible • Throughput • Maximize the number of processes completed per unit time M.B. Ibáñez
Nonpreemptive Once a process is in the running state, it will continue until it terminates or blocks itself for I/O Preemptive Currently running process may be interrupted and moved to the Ready state by the operating system Allows for better service since any one process cannot monopolize the processor for very long Decision Mode M.B. Ibáñez
First-Come, First Served Scheduling • As each process becomes ready, it joins the ready queue • When the current process ceases to execute, the oldest process in the Ready queue is selected M.B. Ibáñez
FCFS example M.B. Ibáñez
FCFC evaluation • Performs much better for long processes than short ones • The turnaround time for short processes can be high • It tends to favor processor-bound processes over I/O-bound processes • It is not an attractive alternative on its own for single-processor system. However, it is often combined with a priority scheme to provide an effective scheduling. M.B. Ibáñez
Shortest-job-first scheduling-nonpreemptive- The process with the shortest expected processing time is selected next M.B. Ibáñez
Shortest-job-first scheduling-nonpreemptive-comments • It needs to know or at least estimate the required processing time of each process • A risk with this policy is the possibility of starvation for longer processes, as long as there is a steady supply of shorter processes M.B. Ibáñez
Shortest-job-first scheduling-preemptive- The scheduler always chooses the process that has the shortest expected remaining processing time M.B. Ibáñez
Shortest-job-first scheduling-preemptive-Comments • There is a risk of starvation of longer processes • Short jobs are given immediate preference to a running longer job M.B. Ibáñez