Operating System (CS604)

Assignment # 02
Spring 2021

 

Total marks =
20                                                                              

 

Deadline Date
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.

$ads={1}

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

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.

$ads={2}

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

 


DOWNLOAD


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

Facebook
Twitter
LinkedIn
WhatsApp

Leave a Reply

Your email address will not be published. Required fields are marked *