Question 13
Consider the following lines of code. Identify the TRUE statements.
int i=0, pid;pid = fork();if (pid > 0){ sleep(1); printf("parent : %d\n", i); wait();} else{ i = i + 1; printf("child : %d\n", i);}Figure 1:
(i) Output is parent : 0 child : 1
(ii) In the parent process, fork returns child pid, and in the child process, fork returns 0 (iii) wait returns the PID of an exiting parent process
(iv) When fork is called, all pages are easily shared between parent and child by copying the parent’s page tables
(i), (ii), and (iii)
(i), (iii), and (iv)
(i), (ii), and (iv)
(ii), (iii), and (iv)