Classification of concurrency patterns
Jay Nelson
jay@REDACTED
Fri May 14 18:15:47 CEST 2010
Joe's list seems to me to address only one general category: parallel
computation. The distinctions in the list may or may not overlap,
but they are all computational parallelisms. Other terms for
computational concurrency that come to mind include PubSub and
Scatter / Gather (which are variants of some that were already listed).
The supervisor pattern only works with concurrency. It is an
Organizational Pattern rather than a Computational Pattern.
I would add the following types of concurrency as a separate category:
Organizational Concurrency
- Supervisor hierarchies
- Serial servers (ala gen_server)
- Event-driven reactors (spawn on each event)
- Process-striped buffers (gen_stream**)
Supervisors detect failure of other processes, therefore they must be
implemented using concurrency. The intelligence of system management
is distributed among the supervisors and defines the behavior of the
system under stress.
Serial servers are used to isolate state and provide distributed
asynchronous access to state (or a computational service) for a
series of unrelated clients. Servers also can be used to impose a
serial order on events, or provide distributed rendezvous control.
Event-driven concurrency is used in web servers so that there is no
contagion of errors from one client to another. It also ensures
memory leaks are not likely to affect the system since spawned
requests are short-lived. Any system which has variable response
time in reaction to events can benefit from concurrency by
overlapping computations in time.
**This weekend I will be checking in gen_stream which uses process-
striped buffering as a new example of organizational concurrency to
provide efficient access to a slow data stream by prefetching the
data. A large piece of data is segmented across processes in a round-
robin fashion much like RAID uses striping of disks.
jay
More information about the erlang-questions
mailing list