The following C program utilises Unix operating system calls to run two processe
ID: 3598436 • Letter: T
Question
The following C program utilises Unix operating system calls to run two processes simultaneously. Explain how the C program achieves this by explaining the purpose of each of the five highlighted operating system function calls. Assume the program child.exe is ready to be executed and returns a value of 5 using its exitfunction. #include #include #include #include int main() ForkPID, ChildPID; pi Unsigned int ChildStatus; Switch( ForkPID- fork)) Case 0: printf("fork() returned %d, my pid via getpid() is %dm", ForkPID, getpid( printf("About to execl)... fflush(stdout); execl("child", "child", "some arg", NULL); printf("Should never get here!!ln"); fflush(stdout); break case -1: perror("fork) failed:"; exit(1); default: printf("Process ID %d, other is %din", getpid(), ForkPD; fflush(stdout); ChildPID -wait(&ChildStatus;); printf("other process PID %d gave exit status %din'. ChildPID, ChildStatus); fflush(stdout); exit(0);Explanation / Answer
package com;
public class DNode<T> {
private T data;
private DNode<T> prev, next;
public DNode(T d, DNode<T> p, DNode<T> n) {
data = d;
next = n;
prev = p;
}
public T getData() {
return data;
}
public DNode<T> getNext() {
return next;
}
public DNode<T> getPrev() {
return prev;
}
public void setData(T d) {
data = d;
}
public void setNext(DNode<T> n) {
next = n;
}
public void setPrev(DNode<T> p) {
prev = p;
}
}