fork()
listener <- socket() bind(listener) listen(listener) loop { active <- accept() if (fork()) close(active) else close(listener) loop write(active, f(read(active))) exit() }
fork()
only
f()
should be expensive
wait()
system calls acknowledge child exits
signal()
system call
wait()
or call wait()
from within the
sigchld signal handler
accept()
EINTR
- need to check that separately
do active <- accept() while active != EINTR
This page last modified on 12 February 2002.