0% found this document useful (0 votes)
20 views8 pages

Presentation Algorithm PDF

Uploaded by

lintumalik326
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views8 pages

Presentation Algorithm PDF

Uploaded by

lintumalik326
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

PRIORITY BASED

SCHEDULING
ALGORITHMS
SUBMITTED TO:
DR. MEHREEN SIRSHAR
SUBMITTED BY:
ARMEEN ABID 2023-BSE-011
AROOBA REHMAN 2023-BSE-012
HAMNA MAHMOOD 2023-BSE-025
KOMAL KASHIF 2023-BSE-031
Introduction:
Priority Assignment:
• Every process is assigned a priority number, either dynamically
(during runtime) or statically (before execution starts).
• The CPU is allocated based on the priority of processes rather than
their arrival time.

Internal vs. External Priorities:


• Internal: Determined based on system-defined criteria like time
limits, memory requirements, or I/O-to-CPU ratio.
• External: Defined by external factors such as the importance of
the process or administrative policies.
Advantages of Priority Scheduling
1. Efficiency: Important tasks can be executed first, improving system
responsiveness for critical processes.
2. Flexibility: It allows both preemptive and non-preemptive modes, making it
adaptable to different requirements.
3. Customizable: Supports internal and external priority factors, enabling fine-
tuned scheduling.

Disadvantages of Priority Scheduling


1. Starvation: Lower-priority processes may never get executed if higher-
priority processes continuously enter the queue.
2. Complexity: Preemptive scheduling requires additional overhead to manage
context switches when processes are interrupted.
3. Priority Inversion: A higher-priority task may wait indefinitely if a lower-
priority process is holding a needed resource.
➢ PREEMPTIVE SCHEDULING:
• In this method, a running process is interrupted if a new process with a higher
TYPES priority arrives.
• The preemption ensures that the CPU is always executing the most important
task available.
• Example:
PROCESS ARRIVAL BURST PRIORITY COMPLET TURNARO WAITING
TIMES TIMES ION UND TIMES
TIMES TIMES
P1 0.0 10.0 3 19.0 19.0 9
P2 2.0 1.0 1 3.0 1.0 0
P3 3.0 2.0 3 20.0 17.0 15
P4 3.0 1.0 4 21.0 18.0 17
P5 4.0 5.0 2 9.0 5.0 0

Average waiting time=9+0+15+17+0/5=8 units


➢ Non-Preemptive Priority Scheduling
• Once a process starts execution, it cannot be stopped until it is completed,
even if a higher-priority process arrives.
• Example:
Turnaround time= Completion time-arrival time

Waiting time=Turnaround time- Burst time

PROCES ARRIVA BURST PRIORIT COMPL TURNAR WAITIN


S L TIME TIME Y ETION OUND G TIME
TIME TIME
P1 0 4 2 4 4 0
P2 1 3 1 7 6 0
P3 2 5 3 14 6 4
P4 3 2 2 9 12 7

Average waiting time=0+0+4+7/4=5.5units


➢ Multi-Level Queue Scheduling
• Uses multiple queues with different priority levels. Processes are assigned
to queues based on priority, and each queue may have its own scheduling
algorithm.
• Example: System processes in the highest-priority queue, interactive tasks
in the next, and batch jobs in the lowest.
• Example Scenario:
A system process (priority 1) preempts a user application (priority 3)
waiting in a lower-priority queue.
Thank you

You might also like