Dear LinuxInfo,
As bscarrier mentioned it is so useful and .... fork() makes a child which is alive until its parent is alive and it is so useful for multiprocessing which makes Linux so powerful, in windows we have Spawn which allows to run two separate processes simultaneously(for example we run ls and main simultaneously) but in Linux we dont have such a thing we have to build it by a fork and an exec, moreover in this trend we have to pay attention to prevent making zombies(which is not good for us) moreover It is useful to know by one fork() we have 2 processes simultaneously, by two fork()s we have 4 processes simultaneously, and ... so we have this trend: processes = 2 ^ (Number of Fork()s).
Spawn
.
|
|
-----
| |
| |
ls main
| |
fork()
.
|
|
-----
| |
| |
ls ls
| |
Regards,
Eilya
|