what happens when you call fork() fork () fork()
Sigiloso
A correction to Raj's formula is the following: Assuming M initial threads and N total forks, this will create a total of M * (2^N) threads. The fork() operation creates a copy of the process that called it. Step 1) That means that starting with 1 initial thread, you call the first fork() operation and you have two identical processes. [Total of 2 processes so far] Step 2) Those two identical processes then go on to call the 2nd fork(), which create identical processes of the two processes calling the operation. [Total of 4 processes so far] Step 3) Those four identical processes then go on to call the last remaining fork(), which create identical processes of the four processes calling the operation. [Total of 8 processes] I encourage anyone to correct any potential mistakes I might have made. The last thing I'd want is to wrongly inform someone going into an interview.