Sunday, November 10, 2019

fork() - Theory


fork() is used create a new child process.
Ø  No arguments
Ø  Process ID of the child process
Ø  After the execution of fork() command both parent & child processes are starting their execution from the next line.

Conditions of  fork()
Ø  fork() > 0 -: not only a child process but also a parent process (Successfully child process created.)
Ø  fork() == 0 -: a child process (Successfully child process created.)
Ø  fork() < 0 -: error in memory allocation (Unsuccessful child process)

Example:



No comments:

Post a Comment

fork() - Theory

fork() is used create a new child process. Ø   No arguments Ø   Process ID of the child process Ø   After the execution of fork() command ...