what is fork() system call in operating system

fork ()
pid_t pid = fork();
fork() creates a new process by duplicating the calling process, The new process, referred to as child, is an exact duplicate of the calling process, referred to as parent, except for the following :
The child has its own unique process ID, and this PID does not match the ID of any existing process group.
The child’s parent process ID is the same as the parent’s process ID.
The child does not inherit its parent’s memory locks and semaphore adjustments.
The child does not inherit outstanding asynchronous I/O operations from its parent nor does it inherit any asynchronous I/O contexts from its parent.
Return value of fork() On success, the PID of the child process is returned in the parent, and 0 is returned in the child. On failure, -1 is returned in the parent, no child process is created, and errno is set appropriately.
total no.of process is created by using fork() system is  2n  times
 total no.of  child process is created by using fork() system is  2-1 times

Comments

Popular posts from this blog

Write C programs to simulate the Paging techniques of memory management

Write C programs to simulate the Two level directory File organization technique

Write C programs to simulate the Hierarchical directory File organization technique