A Transaction Processing Monitor
Process Structure

To function properly, the TPM has to keep track of when processes terminate. Since a process may terminate accidentally due to program error, it is not possible to rely on the application process itself to inform the TPM that it is exiting. Special processes called watchdogs were created for this purpose. When an application is started, it is not forked by the TPM, but by the watchdog process. So that the pipe can be established, the watchdog must be forked by the TPM. Once the application process is forked, the watchdog sleeps. Since the watchdog is the parent process of the application process, it will receive a SIGCHLD signal if the application exits. When this occurs, the watchdog sends a message to the TPM's input pipe telling it that the application has terminated.

UNIX imposes a fixed limit on the number of file descriptors that a process can obtain. Since each link to an application requires one file descriptor, this would be a severe limitation on the number of processes in the system. In order to avoid this limitation, special processes were added to the system to provide extra communication paths. These processes, known as Transaction Message Handlers (TMH) are connected to the TPM with a pipe. A TMH is connected to some number application input pipes (one pipe per application). Each application is connected to exactly one TMH. When the TPM sends a message to an application, it does so by writing it to the TMH input pipe, the TMH then reads the message and writes it to the input pipe of the actual application. Using this scheme, if each TMH has P available pipes, the number of connections available for applications is increased by a factor of P.

There are some situations where it is not possible for an application to be started as a descendant process of the TPM, a prime example being remote processes. In order to support these, another class of system processes exists: the Special Message Handler (SMH). The SMH exists as a descendant of the TPM and communicates with it in the same way as discussed for applications. However, each SMH has a socket that is used to connect with applications that can't be descendants of TPM. The SMH acts as a two-way forwarder --- whatever it reads from the socket, it forwards to the TPM; whatever it reads from the TPM, it writes to the socket.