Librenix
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Primer: The C fork() function

Up
vote
Down

A fork() system call in code that is not thoroughly thought out is a truly dangerous thing...
Of course, there are all kinds of gotchas you must deal with when fork()ing processes or else your sysadmin will get irate with you when you fill of the system process table and they have to punch the reset button on the machine.

First of all, you should know something of process behavior under Unix. When a process dies, it doesn't really go away completely. It's dead, so it's no longer running, but a small remnant is waiting around for the parent process to pick up. This remnant contains the return value from the child process and some other goop. So after a parent process fork()s a child process, it must wait() (or waitpid()) for that child process to exit. It is this act of wait()ing that allows all remnants of the child to vanish.
 read more | mail this link | score:8371 | -Ray, December 23, 2005
More Programming articles...

Colorful Abstract Art

Selected articles

Librenix T-Shirts and Coffee Mugs!

Apple to Intel move no threat to Linux

Space Tyrant: A multiplayer network game for Linux

Linux vs. Windows: Why Linux will win

MiniLesson: An introduction to Linux in ten commands

Tutorial: Introduction to Linux files

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin