Question: C program with three consecutive fork statements such that each fork process runs an infinite loop printing from process (process id) every two seconds. USing

C program with three consecutive fork statements such that each fork process runs an infinite loop printing "from process (process id) every two seconds.

USing the system call setpgid(), ensure that all the descendants of the main process other than its immediate children are terminated upon entering CTR-C

Each of the terminated non-descendants process must print its pid and ppid along with a short message stating that it has been terminated

after the non-child process have been terminated, the main program and its direct desccendants must take turns every 2 seconds to print the statement "This is from process(process id)"

there should be no interleaving of print statements from different processes and they must be printed from each process in the order listed below ccontinuously (starting with main): Note : you must implement this using SIGSTOP and SIGCONT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!