![]() |
Re: How to Create processes in Unix C
it is better to use vfork and then spawn. vfork does not creates a new process till the time we do spawn thereby saving system resources
|
Re: How to Create processes in Unix C
one simple improvement I would like to have in this nice article .
Code:
#include<stdio.h>because printf() is "buffered," meaning printf() will group the output of a process together. While buffering the output for the parent process, the child may also use printf to print out some information, which will also be buffered. As a result, since the output will not be send to screen immediately, you may not get the right order of the expected result. Worse, the output from the two processes may be mixed in strange ways. To overcome this problem, you may consider to use the "unbuffered" write. . Code:
#include <sys/types.h>Quote:
|
Re: How to Create processes in Unix C
Sir, vfork is generally used when you are expected to call "exec".
and fork has "Copy on write" mechanism now so fork even doesn't duplicate address space until needed. Difference between the two is that, when vfork() is called, Parent leans it address space to Child and parent process is suspended, This continues until the child process either exits, or calls exec(), at which point the parent process continues. References : Unix Internals ... uresh vahliya "Jai Hind" |
Re: How to Create processes in Unix C
Sir, vfork is generally used when you are expected to call "exec".
and fork has "Copy on write" mechanism now so fork even doesn't duplicate address space until needed. Difference between the two is that, when vfork() is called, Parent leans it address space to Child and parent process is suspended, This continues until the child process either exits, or calls exec(), at which point the parent process continues. References : Unix Internals ... uresh vahliya "Jai Hindi" |
Re: How to Create processes in Unix C
very very Extremely useful post.....
|
| All times are GMT +5.5. The time now is 04:00. |