Difference between revisions of "Fork"

From Hackepedia
Jump to navigationJump to search
(No difference)

Revision as of 11:37, 5 October 2005

A Unix process gets created by the fork system call. When fork is called inside a program it will create a child process that is exactly the same as its parent(caller of fork). After forking the exec system call is often called in order to make the intended program run. When the fork system call is called it will return 0 in the child and the pid of the child in the parent. If it fails it will return -1 and set errno.



Many clueful system administrators limit how many processes can be forked or else you have a run-away phenomenon called a fork-bomb which happens to creep up in Linux even today.