Question
Assume that the PID of the main process is 42. Each call to fork() in the code is commented to show the PID of the
Assume that the PID of the main process is 42. Each call to fork() in the code is commented to show the PID of the newly created process (The PIDS are thus 42, 11, 25, 89, and 123).
In this exercise we assume that all operations take zero time but for sleep() (which sleeps a prescribed number of seconds) and waitpid(), which obviously might block for a while. We also assume that the execution starts at time zero. Therefore, in all the questions below, whenever time is mentionedeeded, it's always a perfect multiple of 10 (since all calls to sleep in the above program are for numbers of seconds that are multiples of 10). Answer the following questions:
1. What is the PID of the process that prints "** TWO **"?
2. What is the PPID of the process with PID 89?
3. At what time does the process with PID 123 terminate?
4. At what time would "** TWO**" be printed if line 25 were removed?
5. Give the PID of a process that is a zombie at the time when "** TWO **" is being printed
6. Give the PID of a non-zombie process that at some point in the execution becomes an orphan
7. Which processes are "alive" (i.e., not terminated nor zombies) right before the process with PID 123 terminates (PID 123 is thus one of these)?
onsider the following C program (assuming that necessary header files are included and that there are no mpilation or execution errors)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started