Thread Preemption and
PreemptiveTask Scheduling
This presentation provides an overview of thread preemption and
preemptive task scheduling. We'll explore the benefits of preemptive
scheduling. Modern operating systems rely on these methods. We will
also review real-time scheduling and synchronization challenges. Finally,
we'll discuss future trends.
by Ganesh
Shendre
2.
Understanding Thread States
Ready
Thethread is ready to run.
It is waiting for CPU time.
Running
The thread is currently
executing on the CPU.
Blocked/Waiting
The thread is waiting for
an event (I/O, lock).
Terminated
The thread has completed
its execution.
3.
What is ThreadPreemption?
1 Definition
Interrupting a running
thread. This is to allow
another thread to execute.
2 Preemption Points
Occurs during timer
interrupts and I/O requests.
3 Context Switching
Saving and restoring thread state.
4.
Preemptive Task schedulingtechniques
• Several scheduling algorithms were developed to manage
preemptive task switching efficiently:
• Round Robin (RR): Each process is given a fixed time slice in a
circular order.
• Priority Scheduling: Each task is assigned a priority, and the OS
selects the highest-priority task.
• Multilevel Queue Scheduling: Processes are divided into different
queues based on priority or type, with each queue using a different
scheduling algorithm.
5.
Advantages of RoundRobin Scheduling
•Fairness: Each process gets an equal share of the CPU.
•Responsiveness: Round Robin can handle multiple processes without
significant delays, making it ideal for time-sharing systems.
Disadvantages of Round Robin Scheduling:
•Overhead: Switching between processes can lead to high overhead,
especially if the quantum is too small.
•Underutilization: If the quantum is too large, it can cause the CPU to feel
unresponsive as it waits for a process to finish its time.
6.
Types of PriorityScheduling
• Preemptive Scheduling:-
SRTF(Shortest Remaining Time First)
• Non-Preemptive Scheduling:-
FCFS(First come,First serve)
Advantages of MultilevelQueue CPU
Scheduling
Disadvantages of Multilevel Queue CPU
Scheduling
• Low Scheduling Overhead
• Efficient Allocation of CPU Time
• Customizable
• It is inflexible in nature.
• There may be added complexity in implementing
Conclusion
Preemptive scheduling iscritical for modern OS.
It offers significant benefits. These benefits are responsiveness and
fairness. It requires careful design.
Further research into scheduling is ongoing.