How to Achieve Concurrency?

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]

*Coroutines: Each coroutine has its own stack and program counter but only one of them is active. Coroutines can transfer execution to another coroutine.
Advantage: No support of the operating system needed. Low overhead. Disadvantage: Coroutines do not speed up the computation.
 
*Threads: The operating system (or virtual machine) maintains several execution threads (each with its own stack and program counter) in one address space.
Advantage: Speeds up computation on a multi-processor system. Disadvantage:
C. A. R. Hoare, Communicating Sequential Processes: ``In its full generality, multithreading is an incredibly complex and error-prone technique, not to be recommended in any but the smallest programs.''
 
*Processes: Like threads but each thread has its own address space.
Advantage: Correctness can be far easier proved using the techniques from Hoare and Milner. Disadvantage: The communication between the concurrent entities is more complex.
 
*Distributed System: Multiple processes on different computers on a network.
Advantage: Scalable up to the extent of the entire Internet (see http://distributed.net/, for example). Disadvantage: Communications become more complex and network problems introduce new sorts of failures.
 

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]
Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 21, 2002