Download presentation
Presentation is loading. Please wait.
1
Uniprocessor Scheduling I
Chapter 9
2
Goals of Scheduling Quick response time Fast throughput
Processor efficiency
3
Type of Scheduling (1) Long-term Medium-term
performed when new process is created The decision to add to the pool of processes to be executed (chapter 3, process control) Medium-term swapping The decision to add to the number of processes that are partially or fully in main memory (chapter 7 and 8, control structure)
4
Types of Scheduling Short-term I/O which ready process to execute next
decision as to which ready process will be executed by the processor (chatter 9 and 10) I/O decision as to which process’s pending I/O request shall be handled by available I/O device (chapter 11)
5
Scheduling and Process State Transition
New Long-term scheduling Long-term scheduling Ready, suspend Running Exit Ready Short-term scheduling Medium-term scheduling Blocked, suspend Blocked Medium-term scheduling
6
A Seven-State Model - States
Ready: The process is in main memory and available for execution. Blocked: The process is in main memory and awaiting an event. Blocked, suspend: The process is in secondary memory and awaiting an event. Ready, suspend: The process is in secondary memory but is available for execution as soon as it is loaded into main memory.
7
Queuing Diagram for Scheduling
Long-term scheduling Time-out Batch jobs Short-term scheduling Ready Queue Processor Release Medium-term scheduling Interactive users Ready, Suspend Queue Medium-term scheduling Blocked, Suspend Queue Blocked Queue Event Wait Event Occurs
8
Long-Term Scheduling Determines which programs are admitted to the system for processing Controls the degree of multiprogramming More processes, smaller percentage of time each process is executed
9
Medium-Term Scheduling
Swapping Based on the need to manage multiprogramming
10
Short-Term Scheduling
Known as the dispatcher Invoked when an event occurs clock interrupts I/O interrupts operating system calls signals
11
Short-Tem Scheduling Criteria
User-oriented Related to the behavior of the system as perceived by the individual user or process. Response Time: Elapsed time between the submission of a request until there is output. System-oriented The focus if on effective and efficient utilization of the processor
12
Short-Term Scheduling Criteria
Performance-related Performance-related criteria are quantitative and generally can be readily measured. measurable such as response time and throughput Not performance related predictability: a given job should run in about the same amount of time and at about the same cost regardless of the load on the system
13
Priorities Scheduler will always choose a process of higher priority over one of lower priority Have multiple ready queues to represent each level of priority Lower-priority may suffer starvation allow a process to change its priority based on its age or execution history
14
Priority Queuing A set of queues to instead of a single ready queue
RQ0 Processor Release Dispatch A set of queues to instead of a single ready queue RQ1 . . Admit . RQn Priority [RQi] >[RQj] for i<j Preemption Event Wait Event occurs Blocked Queue
15
Decision Mode Nonpreemptive Preemptive
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
16
An Example for Scheduling Policies
Process Service Time Arrival Time 1 3 2 2 6 3 4 4 6 4 5 5 8 2
17
First-Come-First-Served (FCFS)
5 10 15 20 Each process joins the Ready queue When the current process ceases to execute, the oldest process in the Ready queue is selected 1 2 3 4 5
18
Turnaround Time and Service Time
Turnaround Time Tq - the total time that the item spends in the system (waiting time plus service time, or finish time mines arrival time). Service Time Ts - Finish Time minus Start Time. Normalized Turnaround Time - the ratio of turnaround time to service time Tq / Ts
19
FCFS -Normalized Turnaround Time
Process Arrival Serve Start Finish Turnaround Tq/Ts Time Time Ts Time Time Time Tq A B C D Mean
20
Difficulties with First-Come-First-Served
A short process may have to wait a very long time before it can execute Favors CPU-bound processes CPU-bound processes: the processes mostly use processor. I/O processes have to wait until CPU-bound process completes
21
Round-Robin q=1 Uses preemption based on a clock
5 10 15 20 Uses preemption based on a clock An amount of time is determined that allows each process to use the processor for that length of time Next ready job is selected. 2 Ready Time 1 2 3 5 7 10 2 14 4 6 9 3 13 6 8 4 16 12 8 5 11
22
Round-Robin q=4 7 Ready Time 2 4 Ready Time 6 15 8
5 10 15 20 1 7 Ready Time 2 2 4 3 Ready Time 6 15 4 8 5 P2 rest part ready time is 7 P4 rest part ready time is 15 P5 ready time is 8 P4 rest part ready time is 15 P5 ready time is 8
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.