Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Operation System (LAB)

Assignment 4

INSTRUCTIONS:
You are required to complete the tasks according to the following instructions.

• At the start of each task, in every program, you are required to print PROCESS ID of the process,
your NAME, ROLL NUMBER and SECTION.
• Illustrate the code reason where necessary.

TASK:
In Multiprogramming systems, the Operating system schedules the processes on the CPU to have the
maximum utilization of it and this procedure is called CPU scheduling. There are several algorithms
available that CPU uses to enhance the performance of CPU so that CPU utilization is optimized. One of
such scheduling algorithms is Shortest Job First (SJF). Scheduling may be preemptive or non-preemptive.
In Non-preemptive, once CPU given to the process it cannot be preempted until completes its CPU burst.
In Preemptive, if a new process arrives with CPU burst length less than remaining time of current executing
process, preempt. This scheme is known as the Shortest-Remaining-Time-First (SRTF).
1. You are required to develop a program that schedules the processes residing in the ready queue using
SJF Non-Preemptive.
Example 1:
Process Name Arrival Time Burst Time
A 3 8
B 4 12
C 2 4
D 0 7
E 1 5

Example 2:
Process Name Arrival Time Burst Time
A 3 1
B 4 12
C 2 3
D 0 2
E 1 5

• The program will calculate the Average turnaround time and average waiting time for both
examples by prompting from Menu Screen, if the user want to process example 1 or example
2.
• Also, perform the SJF scheduling manually step by step on your notebook. You will draw gantt
chart, calculate average turnaround time and average waiting time and attach screenshot of
code output and the manual output results of both examples in the Document file.
• Use comments while writing code to increase the understandability of the program.
• CODE must not be copied from any resource, use your own business logic by understanding
the problem statement.
Operation System (LAB)
Assignment 4

NOTE:
• Copy all the attached files (.docx, .c) in a folder. The name of the folder must be like
Section-Roll No. (e.g. E1-0026-BSCS-13).
• You must submit assignment till 08-07-2020 before 05:00 pm. Late submissions will be
marked as ZERO.
• Do not copy anything from others. Plagiarized content will also be marked as ZERO.

You might also like