Creating exactly 'n' children of a parent in UNIX.


New Member
Jun 6, 2023
Reaction score
Hi, I am new to Linux and just started to learn UNIX. I saw that fork() creates 2^n-1 children. So I thought about how I can create exactly 'n' children. I searched about it on the web but was not able to find a solution. Is there any way? Please help me out.

The first fork is to two processes, but for a linux program the number of processes it forks into depends on the program and the number of times the fork() system call is actually called. The fork() call creates a new process which copies the calling process which results in the new process having the same memory and open files as the calling process, but although each of the two processes is the same except for their process ID, a linux program can fork multiple times which creates a cascade or tree of processes.

Members online