0% found this document useful (0 votes)
62 views1 page

Os Lab CPU Scheduling Ex. No. - 6: Asst. Lect. Amthal Khaleel

1) The document describes a priority CPU scheduling algorithm where processes are assigned priorities and the highest priority process is allowed to run. Processes with equal priorities are scheduled using FCFS. 2) The algorithm first creates user-specified processes with assigned names, priorities, and burst times. Processes are then sorted by priority. 3) For each process, completion time, waiting time, and turnaround time are calculated. Average waiting time, completion time, and turnaround time are then calculated.

Uploaded by

xc33
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)
62 views1 page

Os Lab CPU Scheduling Ex. No. - 6: Asst. Lect. Amthal Khaleel

1) The document describes a priority CPU scheduling algorithm where processes are assigned priorities and the highest priority process is allowed to run. Processes with equal priorities are scheduled using FCFS. 2) The algorithm first creates user-specified processes with assigned names, priorities, and burst times. Processes are then sorted by priority. 3) For each process, completion time, waiting time, and turnaround time are calculated. Average waiting time, completion time, and turnaround time are then calculated.

Uploaded by

xc33
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/ 1

OS LAB CPU Scheduling Ex. No.

– 6

Priority scheduling algorithm


Aim
Write a program to implement Priority CPU Scheduling algorithm.
Theory
Each process is assigned a priority, and the process with the highest priority is
allowed to run. Equal-Priority processes are scheduled in FCFS order. The shortest-
Job-First (SJF) algorithm is a special case of general priority scheduling algorithm.

Algorithm description

1. Create n processes that specified by the user.

2. For each process assign: name, priority, burst time.

3. Sort those processes according to their priorities.

4. For each process calculate:

a) Completion time for process (i) = waiting time of process (i) + Burst time for
process (i).

b) Waiting time for process (i) = waiting time of process (i-1) + Burst time of
process (i-1).

c) Turnaround time.

5. Calculate:

a) Average waiting time = Total waiting time / n.

b) Average completion time = Total completion time / n.

c) Average turnaround time.

Asst. Lect. Amthal Khaleel Page 1 of 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy