OS Lecture 3
OS Lecture 3
Learning Objectives
Process Scheduling
Categories of Scheduling
Non-preemptive:
Resources cannot be taken away from a process until it
completes execution.
Switching occurs when the running process terminates.
Preemptive:
Resources are allocated to a process for a fixed time.
Processes can be switched from running to ready, or
waiting to ready.
CPU may prioritize other processes, preempting the
current one.
(2) Not Running: Processes that are not running are kept in
queue, waiting for their turn to execute.
Contd….
….. Contd.
Process Queue Implementation:
Each queue entry is a pointer to a specific process.
Queues are typically implemented using linked lists.
Dispatcher Role:
When a process is interrupted:
It is transferred to the waiting queue.
If a process completes or aborts:
It is discarded from the queue.
The dispatcher then selects a process from the ready queue for
execution.
Schedulers
Types of Schedulers:
(1) Long-Term Scheduler
Objectives:
• Increase system performance based on chosen criteria (e.g.,
throughput, turnaround time).
Characteristics:
• Also known as a dispatcher.
• Operates much faster than the long-term scheduler.
Short-Term Medium-Term
Long-Term Scheduler
Scheduler Scheduler
It is a process swapping
1 It is a job scheduler It is a CPU scheduler
scheduler.
Speed is in between both
Speed is lesser than short Speed is fastest
2 short and long term
term scheduler among other two
scheduler.
It provides lesser
It controls the degree of It reduces the degree of
3 control over degree of
multiprogramming multiprogramming.
multiprogramming
It is almost absent or
It is also minimal in It is a part of Time sharing
4 minimal in time sharing
time sharing system systems.
system
It selects processes from It selects those It can re-introduce the
pool and loads them into processes which are process into memory and
5 ready to execute execution can be continued.
memory for execution
https://www.youtube.com/watch?v=976ouzywr5E
Play the video for FCFS Scheduling example problem
Contd…..