Introduction
This chapter approaches two important aspects of the interface between
a programming language and the operating system: communication and
processes. The Sys module presented in chapter
8 has already shown how to pass values to
a program and how to start a program from another one. The goal
of this chapter is to discuss the notions of processes and communication
between processes.
The term ``process'' is used for an executing program.
Processes are the main components of a parallel application.
We introduce processes in the classical way originating from the
Unix system. In this context a process is created by another process,
establishing a parent-child relationship between them. This relationship
allows the parent to wait for the child to terminate, as well as to set
up privileged communications between the two. The underlying model of parallelism is that of
distributed memory.
The term ``communication'' covers three aspects:
-
input and output via file descriptors.
The notion of file descriptors under Unix has a much broader
meaning than the simple reading or writing of data from or to
a storage medium. We will see this in chapter 20, where
programs running on different machines are communicating
via such descriptors;
- the use of pipes between processes which allow
the exchange of data using the principle of waiting queues;
- the generation and handling of signals, which
allow a simple interaction between processes.
The functions presented in this chapter are similar to those in
the Unix module which accompanies the Objective CAML distribution.
The terminology and the notions come from the Unix world. But
many of the functions of this module can also be used under Windows.
Later we will indicate the applicability of the presented
functions.