Network Programming with Perl By Lincoln D. Stein Slots : 1
Table of Contents
Chapter 10. Forking Servers and the inetd Daemon
Content
Concurrent I/O is essential for connection-oriented servers to service multiple clients . Concurrency can also be useful in client code to avoid deadlock situations.
This chapter introduced forking, the most common technique for achieving concurrency. Forking is generally easy to use, but it has a few things to watch for, the most important being the need to wait on exited child processes. It is also common for production servers to detach themselves from the controlling terminal and autobackground themselves . In this chapter we developed a become_daemon() subroutine to do this.
On UNIX systems, the inetd superdaemon provides a simple way to turn ordinary command-line applications into forking servers. You can also use it as a handy way to launch a conventional forking server when needed, thus avoiding having to start the daemon manually.
The next chapters look at other techniques for handling concurrent connections, beginning with multithreading and continuing with multiplexing.