Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 7

Operating System

Module 2-Lecture 4
Scheduling Part 1
Dr. Mainak Biswas
Process Scheduling
• A process is executed until it must wait, typically for the completion of
some I/O request
• In a simple computer system, the CPU then just sits idle
• With multiprogramming, when one process has to wait, the operating
system takes the CPU away from that process and gives the CPU to
another process
CPU-I/O Burst Cycle
CPU Scheduler
• The operating system must select one of the processes in the ready
queue to be executed
• The selection process is carried out by the short-term scheduler (or
CPU scheduler)
• The scheduler selects a process from the processes in memory that
are ready to execute and allocates the CPU to that process.
P2 P1 P4 CPU
P3
MEMORY QUEUE

I/O
I/O QUEUE
Preemptive Scheduling
• Four instances of CPU scheduling
1. When a process switches from the running state to the waiting state (I/O
req) NON-PREEMPTIVE
2. When a process switches from the running state to the ready state
(interrupt) PREEMPTIVE
3. When a process switches from the waiting state to the ready state
PREEMPTIVE
4. When a process terminates NON-PREEMPTIVE
• The dispatcher is the module that gives control of the CPU to the
process selected by the short-term scheduler by switching context,
Switching to user mode etc.
Scheduling Algorithm Performance criteria
1. CPU utilization: keep the CPU as busy as possible
2. Throughput: number of processes that are completed per time unit
3. Turnaround time: The interval from the time of submission of a
process to the time of completion
4. Waiting time: the sum of the periods spent waiting in the ready
queue
5. Response time: time from the submission of a request until the first
response is produced

You might also like