Assignment 2 Child process using “fork ” system call
Write a program in to create a child process using “fork ” system call and display the child process id from parent process and parent process id from the child process. Eplain the output. . rite a program in to show that a function call efore and after a for maes the return value of the function different. (consider a function which will as for an input integer n and return its factorial). Eplain the output. . rite a program in to show that a variale initialied gloally is affected differently while changing the variale value inside the parent and child process. Eplain the output. . rite a program in which taes an argument, a numer of seconds (t) from the command prompt. he program creates a child process. he child waits for t seconds and die. he parentprocesswaitsforthechildprocessto die and then it dies. Also, displaythelistofprocessesinsideothparentand child process. Eplain the output. 5. A tet file pipe1.txt consists of the following passage “his is an eample file testingtheuseofpeepsonthecommandline.peeps provide the user with a synchronied means of interprocesscommunication. wo inds of peeps eist named or unnamed.” se the cat command on pipe.tt. ipe the result to a sed command and change all instances of thewordpeepstopipes.Storetheresultsinafile called pipenew.tt. ecord the command that you used to do this. Save this command in a comment on the first line of your code.