Thread Preemption and
Preemptive Task 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
Understanding Thread States
Ready
The thread 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.
What is Thread Preemption?
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.
Preemptive Task scheduling techniques
• 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.
Advantages of Round Robin 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.
Types of Priority Scheduling
• Preemptive Scheduling:-
SRTF(Shortest Remaining Time First)
• Non-Preemptive Scheduling:-
FCFS(First come,First serve)
Multilevel Queue Scheduling
Advantages of Multilevel Queue 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
Synchronization Challenges
1 Race Conditions
Multiple threads access shared data.
2 Deadlocks
Circular dependency blocks threads.
3 Solutions
Mutexes, semaphores, atomic operations.
Conclusion
Preemptive scheduling is critical for modern OS.
It offers significant benefits. These benefits are responsiveness and
fairness. It requires careful design.
Further research into scheduling is ongoing.

Thread-Preemption-and-Preemptive-Task-Scheduling.pptx(3).pptx

  • 1.
    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)
  • 7.
  • 8.
    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
  • 9.
    Synchronization Challenges 1 RaceConditions Multiple threads access shared data. 2 Deadlocks Circular dependency blocks threads. 3 Solutions Mutexes, semaphores, atomic operations.
  • 10.
    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.

Editor's Notes