Python Threading Tutorial: Run Code Concurrently Using the Threading Module

822,341
0
Published 2019-09-12
In this video, we will be learning how to use threads in Python.

This video is sponsored by Brilliant. Go to brilliant.org/cms to sign up for free. Be one of the first 200 people to sign up with this link and get 20% off your premium subscription.

In this Python Programming video, we will be learning how to run threads concurrently using the threading module. We will also look at how to download multiple high-resolution images online using a ThreadPoolExecutor from the concurrent.futures module. Let's get started...

The code from this video can be found at:
bit.ly/threading-code

List Comprehensions Tutorial -    • Python Tutorial: Comprehensions - How...  
Exception Handling Tutorial -    • Python Tutorial: Using Try/Except Blo...  

✅ Support My Channel Through Patreon:
www.patreon.com/coreyms

✅ Become a Channel Member:
youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join

✅ One-Time Contribution Through PayPal:
goo.gl/649HFY

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist
a.co/inIyro1

✅ Equipment I Use and Books I Recommend:
www.amazon.com/shop/coreyschafer

▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - youtube.com/c/coreymschafer
Facebook - www.facebook.com/CoreyMSchafer
Twitter - twitter.com/CoreyMSchafer
Instagram - www.instagram.com/coreymschafer/

#Python

All Comments (21)
  • @coreyms
    Hey everybody! I hope you find this video helpful. I'll be releasing the multiprocessing video next week. I am currently packing up my temporary recording station and will be moving into my new place tomorrow, so I should be able to get it recorded, edited, and released next week for sure. We'll be covering how to use multiprocessing to process the high-resolution images we downloaded in this video. Hope you all get some good use out of these topics!
  • Corey: I know that sounds confusing. Me: No, you explained that very well.
  • When I first tried to switch my career to programming, I watched Corey's videos. Now, 3 years later, I already got a job in programming and still watch Corey's videos :)
  • Was waiting for this topic to learn from the world's best Python Mentor. Now the wait is over. God bless you.
  • @CwMuller
    Had a service at work that created html pages with indexes of hundreds of xml reports. It used to read each report one by one. Used what I learned here to refactor the code to process files concurrently, which cut the script run time to a fraction of what it used to run at. Thanks for the fantastic tutorial!
  • @vishnusingh4118
    Crystal-friggin'-clear! The coolest part was the real-world examples at the end which ensured there was a concrete takeaway and that it wasn't all just theoretical. The best threading vid on the internet! You keep getting better Corey. More power to you !
  • @LiquidArremer
    I think the best part of these tutorials are the ones were you involve real world examples to show the utility, especially common cases and how it alters from then to now. Keep up the good work Corey!
  • @Sharmapawan98
    Can we have this man rewrite the official docs of python ? Love from India♥
  • @paulh4654
    You are not only the master of this subject matter, but also you are a great communicator who can articulate artfully. I appreciate your time and effort to share your gift with all of us. Thank you so much.
  • You definitely do have a gift. It takes a ton of talent to explain concepts like this with so much lucidity. Whenever someone says they want to learn python, I point them right to your videos. Thanks Corey! I'm indebted to your videos.
  • @excitedbox5705
    This has to be the best made guide ever. This should exist for every programing language. Usually guides only give you the absolute basics and expect you to figure out the more advanced stuff yourself and that is where most people get stuck. The level of detail in this is perfect without making it overly long.
  • This video is a life-saver! I have a project due in 3 days that needs me to do a lot of fancy stuff in a multithreaded program, and I had no clue what multithreaded programs are! I'm in a much better position after watching this video. Thank you, Corey!
  • So I just extended the Thread class into my own class and made something so much more efficient because of this video. Great job!
  • @dano2169
    Literally so many videos out there on threading and multiprocessing but by far this is the best. Thanks Corey!
  • @okyigwegbe1977
    Corey, you are unbelievably good. My python journey has been solid because of your brilliant and simplistic way of explaining the most complex of things. Thank you very much and God bless you.
  • @chazyua
    OMG. This is not the first time you read my mind. Literally just wanted to find some threading topics ! Wow ! Thanks
  • @fredpaik1349
    Thank you Corey for ALL your videos! You are an inspiration and a great teacher. Keep up the good work!
  • @EdiFerreiranet
    10:54 Throw away variable!?! Nice!!! I didn't knew that. Awesome!!! Thank you. You're the best ;)
  • @shinobi9461
    Your tutorials are truly phenomenal. Thank you so much for sharing these videos with everyone, they’re incredible!
  • Almost 2 years since you uploaded this, you reduced my exect time from ~90 mins to ~2 mins at max . Awesome videos, will continue watching