Summary of L-2.8: Pre-emptive Priority Scheduling Algorithm with Example | Operating System
Summary of the Video: L-2.8: Pre-emptive Priority Scheduling Algorithm with Example
The video explains the Pre-emptive Priority Scheduling Algorithm in operating systems, providing a detailed numerical example to illustrate how the algorithm works. Here are the key points and concepts discussed:
Main Concepts:
- Priority Scheduling:
- Processes are assigned priorities, and the CPU is allocated to the process with the highest priority.
- In this example, a lower numerical value indicates a higher priority (e.g., priority 10 is higher than priority 40).
- Preemption:
- In a preemptive scheduling scenario, a currently running process can be interrupted and moved back to the ready queue if a new process with a higher priority arrives.
- The CPU runs the process for a maximum of one time unit to ensure higher priority processes are not missed.
- Gantt Chart:
- A Gantt Chart is used to visualize the scheduling of processes over time.
Steps to Solve the Scheduling Problem:
- Initialization:
- Identify all processes, their arrival times, burst times, and priorities.
- Execution:
- Start from time zero and check which processes have arrived.
- If only one process has arrived, execute it.
- If multiple processes arrive at the same time, select the one with the highest priority (lowest number).
- For preemptive scheduling, run the selected process for only one time unit.
- Context Switching:
- If a higher priority process arrives, preempt the currently running process and move it back to the ready queue.
- Completion Times:
- Continue checking for new arrivals and executing processes based on priority until all processes are completed.
- Record the completion times for each process.
- Turnaround and Waiting Times:
- Calculate the Turnaround Time (TAT) using the formula: TAT = Completion Time (CT) - Arrival Time (AT).
- Calculate the Waiting Time (WT) using the formula: WT = TAT - Burst Time (BT).
- Determine average TAT and WT by summing the total times and dividing by the number of processes.
Additional Considerations:
If two processes have the same priority and arrive at the same time, use their arrival times to determine which to execute first. If arrival times are also the same, use their process IDs to decide the order.
Speakers/Sources:
The video is presented by Gate Smashers, an educational channel focused on computer science and operating systems concepts.
Notable Quotes
— 00:00 — « No notable quotes »
Category
Educational