explain the fork functionfork function causes a


Explain the Fork Function

Fork function causes a new process to be created. The calling progress is duplicated as an exact copy (called the child process) that differs only in process IDs and parent IDs. This function returns the chid's process ID to the parent process and a value of 0 to the child process. After that it is possible to distinguish the two process as a result to the fork () call. The child inherits many handles, IDs, and masks from the parent process. The fork is generally used in conjunction with exec () to load or spawn new process. First the fork is initiated to create a new process context, then exec () is used to overlay the child process with a new executable image. execl(execName, arg0,....) The exec family of functions changes the state of the calling process into a new process.

Once executed, exec will replace the currently executing process with one specified by execName. Optionally parameters may be passed to  the newly running process as variable-number command line arguments (arg0....)  This function is usually used to either replace or overlay  an existing running process or in conjunction with the fork () system call to initiate a new process. Once the fork () call is initiated to copy the process, the child process may in turn exec the new process to be executed. The original process is thus still in memory and active, and the child process has become a new executable image specified by exec Name.

Request for Solution File

Ask an Expert for Answer!!
Operating System: explain the fork functionfork function causes a
Reference No:- TGS0289574

Expected delivery within 24 Hours