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

OS Lab 5

The document provides instructions for a lab exercise on implementing the Shortest Job First (SJF) scheduling algorithm. Students are asked to use a C, C++, or Java programming environment to code the SJF algorithm, which prioritizes the next process to run based on the shortest CPU burst time. They will take input of process burst times, run the SJF algorithm, and output calculations of waiting times, average waiting time, and turnaround times.

Uploaded by

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

OS Lab 5

The document provides instructions for a lab exercise on implementing the Shortest Job First (SJF) scheduling algorithm. Students are asked to use a C, C++, or Java programming environment to code the SJF algorithm, which prioritizes the next process to run based on the shortest CPU burst time. They will take input of process burst times, run the SJF algorithm, and output calculations of waiting times, average waiting time, and turnaround times.

Uploaded by

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

Department of Information Technology

Faculty of Engineering and Technology


University of Sindh Jamshoro

LAB # 5
BS (Information Technology) Part-III
SENG- 529 Operating Systems

Student Name________________________________ Role No___________________________

LAB OBJECTIVE: Understanding and Implementing SJF scheduling Algorithm

TOOLS REQUIRED: Intel based Desktop Pc RAM of 512 MB, Programming


Environment (C,C++, Java)
TERMINOLOGIES:
Shortest Job First scheduling Algorithm : Selects process with shortest CPU burst from the
queue of ready processes. Owing to its simple nature, shortest job first is considered optimal. It
also reduces the average waiting time for other processes awaiting execution.
EXERCISE
Following are given textual algorithms for SJF scheduling algorithm. Compute Waiting time,
Average waiting time and Turn Around Time (TAT) for processes entered by user.
SJF ALGORITHM

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

You might also like