'How to make process tree using fork
Assume that the following two variables have been declared and initialized: int pid1 = 1; int pid2 = 0; Draw a process tree for each of the following program segment: 1.
pid1 = fork();
pid2 = fork();
if (pid1 == 0)
fork();
pid1 = fork();
pid2 = fork();
if (pid1 != 0 || pid2 != 0)
fork();
Would there be any effect of initialization prior calling fork.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
