Operating System (CS604) Assignment # 02


Operating System (CS604)
Assignment # 02
Fall 2020
Total marks = 20                                                       

Question No. 1                                                                                                                         12 Marks      
Considering the two processes SP (Server Process) and CP Client Process, each creates two child process sc1, sc2, and cc1, cc2, respectively.  These processes create two FIFOs, FIFO 1 for reading and FIFO 2 for writing in SP and FIFO 1 for writing and FIFO2 for reading in CP to communicate with each other as shown in the figure.
 
Figure 1. Client-Server Communication
By considering the above scenario, you are required to write the output of the following code snippets.

1. if ((mknod (FIFO1, S_IFIFO | PERMS, 0) < 0) && (errno != EEXIST))
 {
 perror ("mknod FIFO1");
 exit (1);
 }
2. if (mkfifo(FIFO2, PERMS) < 0) 
{
 unlink (FIFO1);
 perror("mknod FIFO2");
 exit (1);
3. if ((readfd = open(FIFO1, 0)) < 0)
 {
 perror ("open FIFO1");
 exit (1);
4. if ((writefd = open(FIFO2, 1)) < 0) 
{
 perror ("open FIFO2");
 exit (1);
5. size = strlen(MESSAGE1) + 1;
 if ((n = read(readfd, buff, size)) < 0) {
 perror ("server read"); exit (1);
 }
6. size = strlen(MESSAGE1) + 1;
 if (write(writefd, MESSAGE1, size) != size) 
{ perror ("client write1"); exit (1);  }
Question No. 2                                                                                                                         08 Marks      
Consider the following set of processes, with the Arrival time and CPU burst time, is given in milliseconds:
Process Arrival Time Burst Time 
P1 0.0 10
P2 2.0 6
P3 3.0 2
Considering the time slice of 4 milliseconds. 
A. Draw a Gantt chart showing the execution of these processes using the Shortest Remaining Time First (SRTF) scheduling.
B. Calculate the turnaround time of each process for the Shortest Remaining Time First scheduling algorithm as per part Calculation of part A?  
C. Calculate the waiting time of each process for the SRTF scheduling algorithm as per the calculation of Part A?

Comments

Popular posts from this blog

MGMT 627 Assignment Solution Idea

MGT501 - Human Resource Management Assignment No.1 Fall 2020

CS101 Assignment no 2