Process creation may be either static or dynamic. If static, then all processes belonging to a program are created when the program starts, and continue until the program as a whole terminates (which occurs when all its constituent processes are finished.) If dynamic, then processes are created and destroyed during program execution.
Tasking (as in Ada) is static. All tasks start and complete together.
FORK .. JOIN and PARBEGIN .. PAREND are dynamic.
Note that dynamic process creation/deletion, while more flexible, involves added runtime overhead.
When processes are created dynamically, we say that the creator process is the parent and the newly created process is the child.
The parent process may either continue in parallel with its children, or may wait for them all to complete before proceeding.
This is not an issue with a static approach such as tasking, since there is no parent per se.
With FORK .. JOIN, the parent continues in parallel with the (single) child.
With PARBEGIN .. PAREND, the parent waits for all its children to complete.
Operating system services that support process spawning frequently allow either option - e.g. DCL SPAWN, SPAWN/NOWAIT and Unix's ability to run programs in the foreground or background. Also, it may be possible for a parent process to ordinarily wait for its children to complete, but to specify that it be awakened early under certain conditions, in which case it may abort its children.
The processes may share all variables in common, some variables in common, or no variables in common.
FORK..JOIN, PARBEGIN..PAREND, and tasking call for all the processes to share global variables (according to the textual nesting of the program); but each process may also have its own local variables.
Current operating system support for concurrent processes, however, often does not allow this, or allows it in a roundabout way.
UNIX: in some implementations, processes may not share data in memory, but may share files. Most current implementations have a set of system services to allocate and use memory that can be shared between processes. Some recent Unix versions also contain a thread facility that does allow shared data between threads within the same process.
VMS: processes ordinarily do not share data, but there are system service calls to allow processes to create/access global sections of common data. (Sharing is possible, but the default is not to share.) Recent versions of VMS contain a threads facility that allows threads within the same process to share data easily.
For distributed computation (where processors are located at geographically distinct sites), sharing of variables is not feasible.
This is because shared variables require a shared physical memory and thus a shared memory bus. High speed memory busses are limited in length to a few feet.
Instead, processes in distributed systems must communicate by message passing (to be discussed further later.)
Of course, message passing may also be used in non-distributed systems, as we shall see.
$Id: concurrency4.html,v 1.3 1998/03/03 23:42:04 senning Exp $
These notes were written by Prof. R. Bjork of Gordon College. In February 1998 they were edited and converted into HTML by J. Senning of Gordon College.