[ic] Server.pm

Mike Heins interchange-users@icdevgroup.org
Sun Sep 22 22:32:01 2002


Quoting Rich Bodo (rsb@ostel.com):
> It appears to me that the above code basically does the following:
> 	   1) set close on exec of the current server (parent) to one
> 	   2) fork off child process 1 (child1)
> 	   3) parent waits for child1 to terminate then exits
> 	   4) child1 forks child2 and child1 exits immediately
> 	   5) child2 waits for it's parent to die then calls
> 	   server_both()

This is a standard UNIX double-fork to avoid wait problems and zombies,
portably.

With copy-on-write for fork, which all modern operating systems have, it
is really no slower than a single-fork and wait. It is *much* more
trouble-free.

With the makeover in Perl 5.8 signals, it just *might* be possible to
make a single-fork and wait work reliably. But busy systems should be
running in PreFork mode anyway, so it is pretty moot.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Experience is what allows you to recognize a mistake the second
time you make it. -- unknown