Go Back

A Quick Abstract:

1. Introduction to Preemptive Priority Scheduling:

Definition:

 Preemptive Priority Scheduling is a CPU scheduling algorithm where each process is assigned a priority, and the process with the highest (or lowest, depending on the variant) priority currently in the ready queue is selected for execution.

2. Priority Assignment:

Priority Levels:

Each process is assigned a priority value, indicating its importance or urgency.

3. Execution and Process Preemption:

High Priority Variant:

The process with the highest priority is selected for execution.

If a higher priority process arrives in the ready queue, it preempts the currently running process.

Low Priority Variant:

The process with the lowest priority is selected for execution.

If a lower priority process arrives in the ready queue, it preempts the currently running process.

4. Waiting Time and Turnaround Time:

Waiting Time:

Waiting time is the cumulative time a process spends waiting in the ready queue.

Turnaround Time:

Turnaround time is the overall time taken by a process from submission to completion.

5. Pros and Cons:

High Priority Variant:

Ensures that critical or urgent tasks are executed promptly.

May lead to starvation for lower priority tasks.

Low Priority Variant:

Allows for fair execution of tasks with less urgency.

Might result in delayed execution for higher priority tasks.

6. Starvation:

High Priority Variant:

There is a risk of lower priority tasks starving for CPU time.

Low Priority Variant:

Higher priority tasks may experience delayed execution.

7. Example Scenario:

Consider processes A, B, and C with priority levels 3, 1, and 2, respectively.

High Priority Variant:

A → B → A → C → ... (and so on)

Low Priority Variant:

B → C → A → ... (and so on)

Processes are dynamically selected based on their priority, with preemption occurring if a higher (or lower) priority process arrives.

8. Conclusion:

Preemptive Priority Scheduling provides adaptability in CPU allocation by allowing dynamic adjustments based on process priorities. However, careful consideration is necessary to prevent starvation for lower priority tasks or delayed execution for higher priority tasks.

Notes From The Slides:



Example of Preemptive Priority Scheduling

Process

Burst Time

Priority

Arrival

P1

10

3

0

p2

1

1

2

p3

2

4

4

p4

1

5

3

p5

2

2

5