5.1 Implementing Child Processes in DEC C

Child processes are created by DEC C functions with the OpenVMS LIB$SPAWN RTL routine. (See the VMS Run-Time Library Routines Volume for information on LIB$SPAWN.) Using LIB$SPAWN allows you to create multiple levels of child processes; the parent's children can also spawn children, and so on, up to the limits allowed by the user authorization quotas discussed in the introductory section of this chapter.

Child processes can only execute other DEC C programs. Other native-mode OpenVMS languages do not share the ability of DEC C to communicate between processes; if they do, they do not use the same mechanisms. The parent process must be run under a Digital-supported command- language interpreter (CLI), such as the DIGITAL Command Language (DCL). You cannot run the parent as a detached process or under control of a user-supplied CLI.

Parent and child processes communicate through a mailbox as shown in Figure 5-1. This mailbox transfers the context in which the child will run. This context mailbox passes information to the child that it inherits from the parent, such as the names and file descriptors of all the files opened by the parent and the current location within those files. The mailbox is deleted by the parent when the child image exits.

Figure 5-1 Communications Links Between Parent and Child Processes


Note
The mailbox created by the vfork and exec functions is temporary. The logical name of this mailbox is VAXC$EXECMBX and is reserved for use by the DEC C RTL.

The mailbox is created with a maximum message size and a buffer quota of 512 bytes each. You need the TMPMBX privilege to create a mailbox with these RTL functions. Since TMPMBX is the privilege required by the DCL commands PRINT and SUBMIT, most users on a system have this privilege. To see what system privileges you have, enter a SHOW PROCESS/PRIVILEGES command.

You cannot change the characteristics of these mailboxes. For more information on mailboxes, see the VMS I/O User's Reference Volume.


Previous Page | Next Page | Table of Contents | Index