Computer Science (Operating Systems)

Complete the code below such that a child process is created by a parent process and the child process doubles the values of the array salaries[10,20,30,40] first and then creates its own child process (called grandchild process). Then, the grandchild process quadruples the original values of the array salaries[10,20,30,40] and prints them. Last, the parent process prints the original values of the array salaries[10,20,30,40].

#define SIZE 4

int salaries[SIZE] = {10,20,30,40}

  int main() { pid_t pid pid = fork(); 

Assume below processes arriving at given times and RR scheduling with q=3 millisecond (ms) is used. Plot the execution of these processes by using Gantt chart and record their Turnaround time and Waiting time for each process in the table given below. Make necessary assumptions, if needed.

rocess Burst Time (ms) Priority Arrival Time (ms) Turnaround Time (ms) Waiting Time (ms)

P1 6 2 8

P2 2 1 8

P3 8 1 0

P4 5 3 2

P5 10 4 6