Day 01Part 12- Operating system for computer – Concept of Priority information in Operating system
Day 01Part 12- Operating system for computer – Concept of Priority information in Operating system
Contents [hide]
- 1 Concept of Priority in Operating Systems
- 2 What is Priority in an Operating System?
- 3 Types of Priority Scheduling
- 4 Static Priority Scheduling
- 5 Dynamic Priority Scheduling
- 6 Types of Priority Scheduling Algorithms
- 7 Example of Priority Scheduling
- 8 Advantages & Disadvantages of Priority Scheduling
- 9 Final Thoughts
- 10 Day 01Part 12- Operating system for computer – Concept of Priority information in Operating system
- 11 OPERATING SYSTEM Lecture Notes On
- 12 Operating System Concepts, 8th Edition
- 13 Operating System Concepts
Concept of Priority in Operating Systems
In an Operating System (OS), priority plays a crucial role in process scheduling, ensuring that important tasks get CPU time before less critical ones. Priority scheduling is widely used in real-time systems, multitasking environments, and resource allocation.
What is Priority in an Operating System?
Priority refers to a numerical value assigned to a process that determines its importance in execution. A higher priority process gets executed before a lower priority process.
Types of Priority Scheduling
Static Priority Scheduling
Priority is assigned before execution and remains unchanged.
Example: Kernel processes, system tasks (always have high priority).
Used in real-time systems where priority is predefined.
Dynamic Priority Scheduling
Priority changes during execution based on factors like aging, CPU burst time, or I/O requirements.
Prevents starvation (low-priority processes getting delayed indefinitely).
Example: Aging Technique (low-priority processes gradually gain higher priority).
Types of Priority Scheduling Algorithms
Algorithm | Description | Advantages | Disadvantages |
---|---|---|---|
Preemptive Priority Scheduling | Higher priority process preempts (interrupts) a lower one. | Ensures important tasks execute quickly. | Can cause starvation of low-priority processes. |
Non-Preemptive Priority Scheduling | Higher priority process waits until the current process finishes. | Simple and avoids frequent context switching. | Long waiting times for lower-priority processes. |
Example of Priority Scheduling
Given processes and their priorities:
Process | Priority | Burst Time (ms) |
---|---|---|
P1 | 3 | 10 |
P2 | 1 | 5 |
P3 | 4 | 2 |
P4 | 2 | 8 |
Execution Order (Higher number = Higher priority): P3 → P1 → P4 → P2 (Executed in descending order of priority).
Advantages & Disadvantages of Priority Scheduling
Efficient execution of critical tasks (useful in real-time systems).
Allows flexibility (different priority levels for different tasks).
Starvation problem (low-priority tasks may get delayed indefinitely).
Requires additional scheduling mechanisms like aging to prevent starvation.
Final Thoughts
Priority scheduling is widely used in real-time OS, process management, and multitasking systems. It ensures that high-priority tasks are executed efficiently, but proper techniques (like aging) must be used to prevent lower-priority processes from waiting indefinitely.
Would you like detailed examples, Gantt charts, or comparison with other scheduling algorithms?