Very nice full presentation. The short of it is that "Python" doesn't support parallel execution. For most programmers, when you talk about having multiple threads, the assumption is that those threads can and will execute in parallel. Unfortunately, Python was designed with single core CPU in mind so even though the idea of threads have existed for a while in computing, code wasn't likely to be run on a multithreaded/multicore/multicpu machine to do anything in parallel. It was just the operating system giving out small slices of time to execute one thread or another and it was perceived like both were happening at the same time -- very much like your graphs show. Python, like most interpreted languages, cannot get over this problem because of the synchronization and locking needed to share access to data across threads so they inherently can only allow one "Python interpreted" thread to run at a time. Only library implementations in C can get around this under the hood by spawning real threads on Python's behalf to do work. Or this "multiprocess" approach, which creates a new process and an independent Python interpreter with entirely separate program state and memory. This approach isn't really a Python solution because any programming language can spawn a new OS process (provided a library is available to access fork() and exec*() system calls) and then the OS will execute that process in parallel on a multicore machine. But the thing about multiple processes is that it's harder and slower to share and synchronize data between processes than it is threads. It may not be an issue in some cases if not much synchronization is needed (the case if only an end result matters at the end of parallel work), but it can be a severe a limitation. The last thing I'll say is that often times IO driven or IO heavy applications don't really need a performance boost of true parallel execution. The wait for IO (disk and network for example) are so slow compared to CPU execution that most threads would be waiting for IO anyways. With proper async-io setup (kqueue, select, epoll, IO completion ports) you can use a single thread to handle and dispatch thousands of IO requests and still be bottlenecked by IO. This is how/why people can still write "performance intensive" applications with interpreted languages and compete with a language like C or C++. Maximizing IO efficiency is simply something that sometimes C/C++ won't offer any benefit for so much "slower" languages appear to be just as fast.
Absolutely the best video on youtube describing how threading works in Python, with concise demonstrations and a well thought of script and presentation. 10/10, subscribed
As a budding bioinformatician, it is essential to know whether a task of a pipeline we are developing or optimizing is CPU-bound or I/O-bound. You did a great job by providing this invaluable resource for multiprocessing and multithreading in python. Thank you for your time.
This is the most comprehensive video I've ever seen on multithreading and multiprocessing. Great job!
Excellent explaination about the most complicated questions that I have ever come across in an interview setting. Even though, this is an after math I am super glad to learn in with such a thought clarity. This is how you become fear-less!!! Thank you Dave ❤!
this video is amazing, honestly one of the best I've ever seen, thank you from the bottom of my heart for dedicating so much time to creating it❤️
Massively underrated video. Saved it in my library. Thank you sir.
The best I have ever watched on multiprocessing v/s threading!! The visualizations were a complete treat ❤
The amount of work done here is unblievable. Thank you so much
It is my first time to figure out the multiprocess and threading in Python. Thanks a lot.
Thankyou Dave, i'm so glad youtube algo's bought your video to my daily feed. A really fascinating insight into thread and processes and the presentation style was perfect. Best wishes.
This channel is a hidden gem!
What an incredible video. I’ve just been blindly picking one or the other, not sure the differences between either one, but this makes everything so clear. I’m so glad I found it!!
This is the very best explanation of threading vs multiprocessing that I have ever seen. Well done!
Literally the best video ive seen yet on this topic. Keep posting man!
This sooooooo great.... probably the best explanation on YouTube
I really, really don’t understand why you don’t have more followers. Keep up the good work. This is really well done! Informative and straight out fun!
2 minutes into this I already understand it better than all other readings I did online. Nice!
Yay, it's so interesting to see a visual representation of something that I have been figuring out during my work for a few years with threading\multiproc. When you understand it on instincts but not so visualized and vivid.
@sorcerer_of_supreme