Summary
It was a long journey, but we successfully struggled through the most basic approaches to concurrent programming available for Python programmers.
After explaining what concurrency really is, we jumped into action and dissected one of the typical concurrent problems with the help of multithreading. After identifying the basic deficiencies of our code and fixing them, we turned to multiprocessing to see how it would work in our case.
We found that multiple processes are much easier to use with the multiprocessing
module than base threads with threading
. But just after that, we have realized that we can use the same API with threads too, thanks to multiprocessing.dummy
. So the choice between multiprocessing and multithreading is now only a matter of which solution better suits the problem and not which solution has a better interface.
And speaking about problem fit, we finally tried asynchronous programming, which should be the best solution for I/O bound applications, only to realize...