L-2.1: Process Scheduling Algorithms (Preemption Vs Non-Preemption) | CPU Scheduling in OS
Summary
TLDRThis video explains the concept of scheduling algorithms in operating systems, focusing on how processes are selected from the ready queue and executed on the CPU. It covers key types of scheduling, including pre-emptive and non-pre-emptive algorithms, with examples like Round Robin, SRTF, and FCFS. The video clarifies the differences between these approaches, such as when a process is interrupted or allowed to finish completely. It also explores practical aspects like time quantum, priority, and responsiveness, providing insight into how these algorithms influence process execution in a multi-tasking environment.
Takeaways
- 😀 Scheduling algorithms determine which process from the ready queue should be executed by the CPU.
- 😀 Ready queues in operating systems are stored in RAM and help manage multiple processes for execution.
- 😀 In a uni-processor system, only one process can be executed at a time on the CPU.
- 😀 Pre-emptive scheduling allows a process to be interrupted and placed back in the ready queue before it finishes executing.
- 😀 Non-pre-emptive scheduling ensures a process runs to completion before switching to another process.
- 😀 Pre-emptive scheduling is commonly used for better responsiveness, allowing quicker turnaround for all processes.
- 😀 The time quantum concept in pre-emptive scheduling limits each process's execution time to a fixed duration.
- 😀 Priority scheduling can also be pre-emptive, allowing higher-priority processes to pre-empt lower-priority ones.
- 😀 Non-pre-emptive scheduling includes algorithms like FCFS, Shortest Job First, and Longest Job First, where processes execute fully before switching.
- 😀 Common pre-emptive scheduling algorithms include SRTF, LRTF, Round Robin, and Priority Scheduling.
- 😀 The video emphasizes the importance of scheduling algorithms for exam preparation, particularly for SRTF and Round Robin, which are frequently tested in exams like GATE and UGC NET.
Q & A
What is the purpose of scheduling algorithms in an operating system?
-Scheduling algorithms are used to select a process from the ready queue and allocate it to the CPU for execution, ensuring efficient CPU utilization and managing the execution of multiple processes.
What is the difference between preemptive and non-preemptive scheduling?
-In preemptive scheduling, a running process can be interrupted and moved back to the ready queue, while in non-preemptive scheduling, a process runs to completion once it starts executing, without being interrupted.
Can you explain the concept of time quantum in preemptive scheduling?
-Time quantum is a predefined slice of time allocated to a process in preemptive scheduling. When the time quantum is exhausted, the process is moved back to the ready queue, allowing another process to use the CPU.
How does preemptive scheduling help improve system responsiveness?
-Preemptive scheduling improves responsiveness by allowing all processes, including the ones with lower burst times, to get CPU time more quickly. This ensures that processes like those from the last student in a classroom analogy aren't delayed excessively.
What factors might trigger preemption in preemptive scheduling?
-Preemption can be triggered by factors like a process reaching its time quantum, the arrival of a higher-priority process, or the need to execute a process with a smaller burst time first.
Can you explain the round robin scheduling algorithm?
-Round Robin scheduling is a preemptive algorithm where each process is assigned a fixed time quantum, and the CPU switches between processes after the time quantum expires. This ensures that all processes get a fair share of CPU time.
What are the advantages of using non-preemptive scheduling?
-Non-preemptive scheduling ensures that a process completes its execution once started, reducing the chances of overhead due to frequent context switches, and ensuring process predictability.
What is the role of priority in preemptive scheduling?
-In preemptive scheduling, priority can cause a process to be preempted in favor of a higher-priority process. If a process with a higher priority arrives while another process is running, the CPU may switch to the higher-priority process.
What is the difference between FCFS and SJF scheduling algorithms?
-FCFS (First Come First Serve) schedules processes in the order they arrive, without considering burst time, while SJF (Shortest Job First) selects the process with the shortest burst time first to optimize CPU usage.
What is the Highest Response Ratio Next (HRRN) algorithm?
-The Highest Response Ratio Next (HRRN) algorithm selects the process with the highest response ratio, which is calculated using a formula involving waiting time and burst time. This aims to balance fairness and efficiency in scheduling.
Outlines

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowMindmap

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowKeywords

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowHighlights

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowTranscripts

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowBrowse More Related Video
5.0 / 5 (0 votes)