0% found this document useful (0 votes)
13 views2 pages

Distributed Operating System Lab 7

Uploaded by

Nazmul islam
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)
13 views2 pages

Distributed Operating System Lab 7

Uploaded by

Nazmul islam
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/ 2

Distributed Operating Systems Lab 7

Design aspects of operating system

Simulations of SJF Scheduling Algorithm

Purpose of this Experiment

After completing this manual, you will able to learn how to simulate SJF Scheduling Algorithm.

Description of SJF scheduling algorithm:

SJF: Shortest Job First (SJF) is a type of disk scheduling algorithm in the operating system in
which the processor executes the job first that has the smallest execution time. In the shortest Job
First algorithm, the processes are scheduled according to the burst time of these processes.

AIM: Using CPU scheduling algorithms find the min & max waiting time.

THEORY:
Example of Non-Preemptive SJF
Process Arrival Burst
time Time

7
P1 0.0
P2 2.0 4
P3 4.0 1
P4 3.0 4

P1 P2 P3 P4
0 7 8 12 16

Example of Preemptive SJF

Process Arrival Burst Time


Time
0.0 7
P1
P2 2.0 4
P3 4.0 1
P4 3.0 4

P1 P2 P3 P2 P4 P1
0 2 4 5 7 11 16

Average waiting time = (9 + 1 + 0 +2)/4 = 3


ALGORITHM SJF:
1. Start
2. Declare the array size
3. Read the number of processes to be inserted
4. Read the Burst times of processes
5. sort the Burst times in ascending order and process with shortest burst time is first
executed.
6. calculate the waiting time of each process
wt[i+1]=bt[i]+wt[i]
7. calculate the turnaround time of each process
tt[i+1]=tt[i]+bt[i+1]
8. Calculate the average waiting time and average turnaround time.
9. Display the values
10. Stop

HW: Write a program to implement preemptive shortest job first (SJF) scheduling algorithm.

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