Featured Post

Saturday, March 26, 2016

difference between fork() and vfork() system call

  

In UNIX first init() program will be loaded in kernel. init() is the parent process for all child processes. 

process handling system calls in UNIX:
      
                      A process is nothing but a program in execution. In UNIX for every process there is a address space in which process environment will be loaded. The following are some important system calls are used in handling processes in UNIX.


  1. fork() and vfork() system call
  2. exec() family of system calls
  3. wait() system call
  4. exit() system call
On this post i just explaining the difference between fork() and vfork() system call

In UNIX fork() system call is used to create a child process. Generally the child process will share the address space of parent. i.e., child have a duplicate copy of the parent's address space. 

vfork() system call is used to create child process but works differently when compared to fork() system call. Vfork() system call do not make any copy of the parent process's address space. The child process executes in the parent's address space. So parent's data can be overwrite. Due to this reason parent process will be suspended until the child process(created using vfork()) exits.

note: The child process created as a result of vfork() system call will execute faster then child process created using fork() system call.i.e., vfork() system call is faster the fork() system call.


process chain using fork system call




Unix operating system Linux operating system shell programming bourn shell kourne shell c shell difference between unix and linux operating system , history of UNIX, red hat operating system. UNIX OS architecture , kernel utility programs , file handling process handling inter process communication pipes shared memory message queues socket programming TCP/IP , UDP programming , One to One chat Application , Basic shell program to add two numbers , echo function , while loops clear gt lt le ge ne eq if fi while do done case array in unix strings , cut copy paste cat dir pwd getcwd chdir command read write stat lseek fstat flock mechanism.even or add program vi editor command ni vi editor command mode esc mode insert mode aa dd x :q :wq :w

No comments:

Post a Comment