Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

In the client and server model, communication takes the form of request and reply pairs, which are
initiated by the client and serviced by the server. For example, servers support Internet services
such as FTP, TELNET, SMTP, and so on. This subsection focuses on how using static servers and
demon processes can improve system performance in the OSS environment.
A dynamic server is a server process created by an application or super server to handle a new
request as it comes in. Dynamic servers work well when the request rate is low or the time required
to provide the service is relatively long, such as with FTP.
A dynamic server exists only as long as it is needed. It is created to handle each new request,
service the request, then quit; many dynamic servers can be created and run simultaneously.
Dynamic servers are commonly used in UNIX networking environments for handling many incoming
requests.
A static server is a server process started from the shell. A static server typically performs one
function. In a UNIX environment, static servers often start dynamic servers.
A static server creates a socket, binds that socket to a specific address (including a communications
port), and listens to that address for connection requests for a specific service. When a connection
request arrives, the static server can create a new process as a dynamic server to perform the
service either by calling a fork() function followed by one of the exec functions or by calling
the tdm_spawn() or tdm_spawnp() function to perform the fork and exec operations in one
step. The new process can be started on the same or a different processor.
A static server can be a server process started by another server. A static server exists continuously
(while the system is running) and handles requests as it receives them, usually by interacting with
a queue file. It does not terminate after handling a request.
You should use static servers when the request rate from clients is high and the time to service the
request is short (relative to the time to process calls to the fork() function and the exec set of
functions). If the program you are porting to the OSS environment uses many calls to fork() and
the exec set and you do not use static servers, you will have a slowing of system performance.
For example, the World Wide Web (WWW) server program httpd is implemented in UNIX
systems as a dynamic server. Each time a new request is received by the WWW server, a new
process is created by the fork() function to handle the incoming request. When the handling of
the request is complete, the process terminates. The WWW server handles multiple requests in
parallel by creating a new process to handle each request to completion.
In the OSS environment, the iTP Secure WebServer program httpd is implemented as a set of
static servers. That is, the iTP Secure WebServer creates a number of static servers, which read
their requests from a queue file written by the iTP Secure WebServer, which, in turn, listens for
incoming requests from the network. Each static server waits for another request—after it has
handled a current request. This strategy enables requests to be processed without the additional
overhead of process creation and termination. (Refer to the iTP Secure WebServer System
Administrator’s Guide for more information about the iTP Secure WebServer; refer to the httpd(8)
reference page online on systems that have the iTP Secure WebServer installed for more information
about httpd in the OSS environment.)
A demon (or daemon) is a system process, usually a server process, started at system initialization.
Examples of demons are an application process that is always running or a process that executes
under control of the timing subsystem. Demons are often listener processes, handling remote requests
and supporting user-level functions in a network; they can start static servers and dynamic servers.
The Guardian LISTNER process and the UNIX inetd process are both examples of demon
processes. The OSS version of inetd is not a true demon, because it is not started at system
initialization; OSS inetd is a static super server, as described under “Guardian LISTNER Versus
UNIX and OSS inetd” (page 105).
104 OSS Porting Considerations