Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to use fork

Status
Not open for further replies.

nimberg

Programmer
Sep 14, 2000
8
0
0
IL
hello all
i need a good exemple how to use the fork in uinx c++
i need a sinple code that use fork and i will be able
to GCC ezy...
i rilly hope that sumbudy have or know how to do it
10X
nimrod
 
#include <unistd.h>

pid_t fork(void);


fork creates a child process that differs from the parent
process only in its PID and PPID, and in the fact that
resource utilizations are set to 0. File locks and pend­
ing signals are not inherited.

Under Linux, fork is implemented using copy-on-write
pages, so the only penalty incurred by fork is the time
and memory required to duplicate the parent's page tables,
and to create a unique task structure for the child.


As always, I hope that helped!

Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top