Introduction To Concurrent Programming
Introduction To Concurrent Programming
Programming
Rob Pike
Computing Sciences Research Center
Bell Labs
Lucent Technologies
rob@plan9.bell-labs.com
February 2, 2000
1
Overview
Our approach is not the only way. There are many others;
here is a sampling:
Languages:
Occam
CCS
Esterel
Concurrent ML
Algol 68
Ada
Java
Techniques:
Fork/join
Semaphores
Asynchronous message passing
Condition Variables
RPC
4
Packages:
POSIX and other Unix threads
RPC
Operating Systems:
Amoeba (Mullender & Tanenbaum)
V (Cheriton)
Topaz (Redell et al.)
Saguaro (Andrews)
SOS (Shapiro)
5
Notation
Function to Process
Process
Process management
Communication channels
Synchronization
Semaphore
Spin lock
Queued lock
Condition variables
14
A simple example
Channels as capabilities
The next prime is the first integer that emerges from the output
stream of the first process, 3. Create a process that prints that
number and passes the rest along, removing numbers that are
zero modulo 3.
The next prime is the first integer that emerges from the output
stream of the second process, 5....
18
Example continued