Understanding concurrency and parallelism
Concurrency refers to the number of simultaneous tasks a system executes. Computers’ processors execute atomic operations at amazing speed, but they execute them one at a time. The result is that it looks like they are executing non-atomic tasks simultaneously.
To illustrate the idea, the following diagram shows two programs, each of which consists of three atomic operations: a processing task, reading a long file, and finally, another processing task:

Figure 2.1: Two concurrent programs being executed by a single processor
Imagine that both programs are launched at the same time. The processor executes the first atomic task of one of them and when there is a blocking operation that depends on a resource other than the processing unit, it uses the interruption mechanism to execute the first task of the second program. Both programs are executed concurrently by the processor.
Python offers several mechanisms to handle...