Linux Today: Linux News On Internet Time.

Reboot Linux using simple fork() | Hacking Truths

Jan 16, 2009, 04:32 (4 Talkback[s])

[ Thanks to Hungry Hacker for this link. ]

" In the above program, I have used a loop of 300 iterations. In the first iteration it will execute the fork command which will create a child process which is the exact copy of the parent process i.e. the child process will have the same code as the parent process and it will execute simultaneously with the parent process. So in the next iteration both parent process and the child process will execute fork command which will in turn create child processes with the exact copy of their parent processes and this process of creation of child processes will be in the power of 2 i.e. after the first iteration the total number of processes will be 1 parent and 1 child = 2 process. After 2nd iteration the number of process will be 1 parent and 3 child = 4 process. And this will continue to double and at the end the total number of processes will be 2300 which is quite a big number."

Complete Story

Related Stories: