

This tutorial covers what is multi-threading and then shows how to create multiple threads in python program. It explains what is multithreading with examples, how to import the threading module and how to implement multi-threading.
Topics that are covered in this Python Video:
0:00 What is multithreading?
1:49 Example of multithreading
5:20 Import threading module and implementing multi-threading
Code used in this tutorial:
Next Video:
Python Tutorial – 27. Multiprocessing Introduction:
Website:
Facebook:
Twitter:
Patreon:
source
Step by step roadmap to learn data science in 6 months: https://www.youtube.com/watch?v=H4YcqULY1-Q
Learn data science with pandas: https://www.youtube.com/watch?v=CmorAWRsCAw&list=PLeo1K3hjS3uuASpe-1LjfG5f14Bnozjwy
Machine learning tutorials with exercises:
https://www.youtube.com/watch?v=gmvvaobm7eQ&list=PLeo1K3hjS3uvCeTYTeyfe0-rN5r8zn9rw
This was my output (messd up) 🙁
“`
calculate square of numbers
calculate cube of numbers
square:cube: 4
8
square: 9
cube: 27
cube:square: 64
512
square:cube: 81729
done in : 0.8602502346038818
Hah… I am done with all my work now!
“`
great explanation
73 Dislike can't believe if you don't understand anything just comment someone will answer you.
In thonny IDE , run time had doubles 😂.
I don't know what's the reason but failing in thonny🤣
if i want to get data from t1, in case t1 was in another class, how i can get that data
Cut this music, I couldn't stand it for a minute
Your explanation on threading was awesome!!
Teaching CS through story telling ! Brilliant that is the way to …
Good job man. Specifically, real examples you use are always interesting. 😀😀😀
how terrible music behind! impossible to follow the lesson
I like the way you explain…simply superb!!!
watch at 2x speed
Hey, can we use multi-threading to speed up our prediction through model? If that's possible, can you tell how to do that?
Sir I did the same thing in which i am searching a specific word in the files of two different folders named "folder1" and "folder2".I make two threads and in each thread passing both functions find_text1() in "thread1" and find_text2() in "thread 2" both functions search the word in their respectiv folders . But there is no time difference between normal execution and with multi threading.
Kindly guide me why their is no time difference …
I like the busy mom analogy. I can't even multi task in real life fr
Great tutorial. Thank you so much
Thank you! Great explanation, easy to follow. This will help my little project a lot!
can we create multiple threds in one class
Great explanation. This is so clear. Thanks so much!
I love how you used "busy mom" as the non-coding example which made everything afterward so easy to digest. I initially did not follow what join() meant til I stuck til the end of the video after you provided a diagram with it 🙂
Everywhere else on the Internet has not done a good job of explaining JOIN(), but you did! 🙂
codebasics, everyone loves you this is awesome.
Thanks for sharing! Good video!
Very good but please no music.
anyone thinking about the return value of the function, it seems easiest way is either introducing Queue or using Threadpool!
I don't agree with the analogy between mom's tasks and multi-threading, there is a subtle difference. Multi-threading is not really parallel execution of tasks.
In the video, each function runs only when the other is waiting, so it not true parallelism. It is called concurrency in programming terminology and is different from parallelism.
In the example from the video, the mom's tasks are truly "parallel" because she juggles multiple tasks without any wait in between. They are the equivalent of multi-processing and not multi-threading.
Finally, the example in the video is not a good use case for multi-threading because the total run time is only increased by including threading and wait times. Multi threading is good for scenarios where I/O is the bottleneck – for example, multiple web requests.
skip to 1:49 for the content
hey this is amazing! I actually learned something from this while having the chill acoustic music playing. It really makes it less frustrating. Thank you my dude.
Bruh I've always hated python but it's a very useful language so I've been forcing myself to learn it. You are absolutely the most clear and concise way I've found so far to explain it. Now I understand it and can actually use it, instead of just having code to copy and paste
Concepts are well explained but the example looks noob
Amazing explanation thank you !!
This is first time that I am seeing the concept of Multi-threading is explained in such a simple way… Great work dude…! Keep on going…!
how to stop a thread from a function
Great stuff, but why the music?
Thanks, man, indeed really good tutorial!
[x**2 for x in (1,2,3,4,5,6,7,8,9)] ; [x**3 for x in (1,2,3,4,5,6,7,8,9)] # 😀
In threading why we use ".join" method
in threading why use join method
why we use time.time()-t..?
Thank you!
Thank u so much India
Can we perform multithreading on two different python (.py) files?? If Yes then How…??? Kindly reply ASAP…
Great tutorial.
Thanks..
Thanks your videos Helped me
python requests http://bit.ly/2PPPr0p
That was a great introduction for me. Simple and clear. I watched other examples before this one and I left more confused. I'm half deaf, too, so I appreciated the lower music volume, too (one symptom of partial deafness is the inability to separate background from foreground sounds of equal volume)
Very good tutorials!
"mom is doing multi-threading"
Absolutely great explanation and useful material. THANKS A LOT!