To run this Python program, save the code in a file threads.py and use the python command.
When we run this program, we see the output of the blocking call first, then the output from the two threads. The threads’ output may be interleaved because threads are being run concurrently.
Next, we’ll look at a complement to threads in concurrent programming: synchronization mechanisms like locks and queues.