Question: 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.


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. program! 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 program? in fifo_one. After reading your name and VUID, program! 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 program! 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.

Consider the following three processes, with the Arrival time and CPU burst time, is given in milliseconds:
Process P1 P2 P3 Arrival Time 0.0 1.0 3.0 Burst Time 3

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

Process P1 P2 P3 Arrival Time 0.0 1.0 3.0 Burst Time 3 8 00 6

Step by Step Solution

3.43 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!