The code in SegmentA creates M new processes What will be th
The code in Segment_A creates M new processes. What will be the total number of processes created by the following code segment including the original process?
int main {
fork();
Segment_A
fork();
}
Solution
The first fork creates a new process. So total there are 2 processes.
Segment_A is executed twice. So 2M new processes are created. So now total there are 2(1+M) processes.
The next fork again creates 2(1+M) processes, so now total there are 4(1+M) processes.
