Synchronous, Asynchronous, and Threaded Execution
There is a nuanced distinction between the concepts of concurrent programming: synchronous, asynchronous, and threaded execution. To clarify it, we will start from the very beginning, with the concept of concurrent and parallel programs.
Concurrency
The idea of concurrency is more than one task being executed simultaneously. Concurrency doesn't specify how the simultaneity will be achieved. It only indicates that more than one task will be completed in a given period. Tasks can be dependent, parallel, synchronous, or asynchronous. The following diagram shows the concept of concurrent work:
Figure 5.1: The abstraction of the concurrency - a few people working on the same computer
In the preceding diagram, three people are working at the same time on one computer. We aren't interested in the way they do that, it's doesn't matter for this level of the abstraction.
Parallelism
Parallelism occurs when several tasks...