0% found this document useful (0 votes)
41 views

Assignment # 02: Spring 2021

This document provides instructions for Assignment #02 for the Operating System course CS604. It details that the assignment is due on March 06, 2021 and outlines penalties for late or plagiarized submissions. Question 1 (worth 15 marks) involves writing two C programs to perform inter-process communication using a FIFO and displaying output. Question 2 (worth 5 marks) asks students to draw a Gantt chart and calculate turnaround and waiting times for three processes under Shortest Remaining Time First scheduling. Links are provided for tutorials on writing programs in Linux, installing VirtualBox and Ubuntu, and running Ubuntu in a web browser.

Uploaded by

Shehroz Alam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Assignment # 02: Spring 2021

This document provides instructions for Assignment #02 for the Operating System course CS604. It details that the assignment is due on March 06, 2021 and outlines penalties for late or plagiarized submissions. Question 1 (worth 15 marks) involves writing two C programs to perform inter-process communication using a FIFO and displaying output. Question 2 (worth 5 marks) asks students to draw a Gantt chart and calculate turnaround and waiting times for three processes under Shortest Remaining Time First scheduling. Links are provided for tutorials on writing programs in Linux, installing VirtualBox and Ubuntu, and running Ubuntu in a web browser.

Uploaded by

Shehroz Alam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Operating System (CS604) Total marks = 20

Assignment # 02 Deadline Date

Spring 2021 03/06/2021

Please carefully read the following instructions before attempting the assignment.

RULES FOR MARKING


It should be clear that your assignment would not get any credit if:
 The assignment is submitted after the due date.
 The submitted assignment does not open or the file is corrupt.
 Strict action will be taken if the submitted solution is copied from any other student or the
internet.

You should consult the recommended books to clarify your concepts as handouts are not
sufficient.
Assignment Submission:
You are supposed to submit your assignment in .doc or Docx format.
Any other formats like scan images, PDF, zip, rar, ppt, and BMP, etc will not be accepted.
You are required to send question no. 1 as a screenshot displaying the compilation and running
of both required programs. Furthermore C code of question no. 1 for both Programs should also
be pasted in the same word file after the screenshot. Question No. 2 answer should also be pasted
in the same word file

OBJECTIVE
The objective of this assignment is to provide hands-on experience of:
 To learn and understand inter-process communication using FIFOs.
 SRTF scheduling algorithm

Note: Lectures No. 8 to 15 are covered in this assignment.

NOTE

No assignment will be accepted after the due date via email in any case (whether it is the case of
load shedding or internet malfunctioning etc.). Hence refrain from uploading assignments in the
last hour of the deadline. It is recommended to upload the solution file at least two days before
its closing date.

If you find any mistake or confusion in the assignment (Question statement), please consult with
your instructor before the deadline. After the deadline, no queries will be entertained in this
regard.

For any query, feel free to email at:


Cs604@vu.edu.pk
Question No. 1 15 Marks
Write the two C programs named program1 and program2 that perform inter-process
communication through FIFO. The functionality of the two programs should be as follows.
 program1 should create a FIFO as fifo_one by using mknod() system call or through
mkfifo() library call. program1 should open the fifo_one for reading purposes
through open() system call. Then use the read() system call to read from fifo_one,
your name, and VUID that is written by program2 in fifo_one. After reading your
name and VUID, program1 should display it on the screen by write() system call.
 program2 should open the fifo_one for writing purposes through open() system call.
Then use the write() system call to write in fifo_one your name and VUID. And
finally, close and remove the fifo_one.
Use only read() and write() system call for reading and writing your name and VUID from
FIFO and finally writing on the terminal screen. As by default in FIFO both read() and write()
system call do the blocking I/O.
As the two programs can’t be run simultaneously in the foreground on the terminal window.
So you need to run program1 in the background and subsequently program2 should be run
in the foreground.
Following is the sample screenshot of both programs. You need to perform the following
steps in the screenshot.
 In the screenshot firstly you should compile both C programs.
 Run the program1 in the background. finally,
 run the program2.
C code of question no. 1 for both programs should also be pasted in the same word file after
the screenshot. Question No. 2 answer should also be pasted in the same word file.
Question No. 2 05 Marks
Consider the following three processes, with the Arrival time and CPU burst time, is given in
milliseconds:

Process Arrival Time Burst Time


P1 0.0 3
P2 1.0 8
P3 3.0 6

A. Draw a Gantt chart showing the execution of three processes using the Shortest
Remaining Time First (SRTF) scheduling.
B. Find the turnaround time of each process for the SRTF Shortest Remaining Time First
scheduling algorithm as per the Gantt chart.
C. Calculate the waiting time for the three processes for the SRTF Shortest Remaining
Time First scheduling algorithm as per the Gantt chart?

Note: in case you have installed the Virtual Box you can take the screenshot as follows.
Go to the view menu and click on Take Screenshot as follow.
See the following link for writing and compiling your first program in Linux.
https://vulms.vu.edu.pk/Courses/CS604/Downloads/how%20to%20Write%20and%20run
%20program.rar
See the following link for downloading and installing VirtualBox and Ubuntu.
https://vulms.vu.edu.pk/Courses/CS604/Downloads/tutorial_for_installing_virtualbox_and_u
buntu.mp4
https://vulms.vu.edu.pk/Courses/CS604/Downloads/Guide%20to%20How%20to
%20download%20and%20Install%20VirtualBox%20and%20Ubuntu.docx
See also the following tutorial links at VULMS for downloading and installing VirtualBox.
https://vulms.vu.edu.pk/Courses/CS604/Downloads/CS604-VirtualBox.mp4
Also see the following tutorial at VULMS, and follow the instructions for Installing Ubuntu in
VirtualBox
https://vulms.vu.edu.pk/Courses/CS604/Downloads/CS604-Virtual%20Machine.mp4

You can work in Linux through chrome web Store, or click at the following link and press the
start button Ubuntu will be started.
https://www.onworks.net/runos/create-os.html?os=ubuntu-16.04.6-desktop-i386&home=init

The End

You might also like