Monday, June 4, 2012

Fork In Unix

The fork API function provides the means to create a new child subprocess form the existing parent process. some difference include is process id of parent and the child is different.

** File locks and signals that are pending to the parent are not inherited by the child process.

The prototype for the fork() function is :

pid_t fork(void);

** The fork call has a very unique structure in that the return value identifies the context in which the process is running . if the return value is Zero, then the current process is the newly created child process. If the return value is greater than Zero then the current process is Parent.


** EAGAIN AND ENOMEM: Both the errors arise from a lack of available memory.

** Rather than copy the page tables for the memory when the fork takes place, the parent and child share the same page tables but are not permitted to write to them . When a write takes place to one of the shared page tables, the page table is copied for the writing process so that it has its own copy. This is called the "copy- on - write".
Only as writes occur to the share data memory does the segregation(The action or state of setting someone or something apart from other people or things or being set apart)  of the page tables take place.

No comments:

Post a Comment

Qualcomm Short Term

  113 is the SL. 1st Target by mid July.

Total Pageviews