|
|
Pipes, named pipes, and signals are all forms of interprocess communication. Business applications running on a UnixWare system, however, often need more sophisticated methods of communication. In applications, for example, where fast response is critical, a number of processes may be brought up at the start of a business day to be constantly available to handle transactions on demand. This cuts out initialization time that can add seconds to the time required to deal with the transaction. To go back to the ticket reservation example again for a moment, if a customer calls to reserve a seat on the 5 o'clock flight to Detroit, you do not want to have to say, ``Yes, sir; just hang on a minute while I start up the reservations program.'' In transaction-driven systems, the normal mode of processing is to have all the components of the application standing by waiting for some sort of an indication that there is work to do.
To meet requirements of this type, UnixWare offers a set of nine system calls and their accompanying header files, all under the umbrella name of interprocess communications (IPC).
The IPC system calls come in sets of three; one set each for messages, semaphores, and shared memory. These three terms define three different styles of communication between processes:
msgget | semget | shmget |
msgctl | semctl | shmctl |
msgop | semop | shmop |
The ``ctl'' calls provide a variety of control operations that include obtaining (IPC_STAT), setting (IPC_SET) and removing (IPC_RMID), the values in data structures associated with the identifiers picked up by the ``get'' calls.
The ``op'' manual pages describe calls that are used to perform the particular operations characteristic of the type of IPC facility being used. msgop has calls that send or receive messages. semop (the only one of the three that is actually the name of a system call) is used to increment or decrement the value of a semaphore, among other functions. shmop has calls that attach or detach shared memory segments.
See ``Interprocess communication'' for a detailed description of IPC, with many code examples that use the IPC system calls. An example of the use of some IPC features is included in the liber application in ``Interprocess communication''.