Тёмный

Python Tutorial - 26. Multithreading - Introduction 

codebasics
Подписаться 1,1 млн
Просмотров 283 тыс.
50% 1

Опубликовано:

 

10 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 232   
@codebasics
@codebasics 2 года назад
Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
@AJG6150
@AJG6150 7 лет назад
This is by far the best threading tutorial on RU-vid. I've literally watched 10 videos and most of them are just writing code not explaining anything. You do the exact opposite where you focus on explaining the code. I just gave a like and subscribe. THANK YOU
@abhii5852
@abhii5852 7 лет назад
saale comment chor
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@Jdjdhsgxuxu
@Jdjdhsgxuxu Год назад
He is the best.
@arnojones8566
@arnojones8566 5 лет назад
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)
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@zack176
@zack176 Год назад
​@@durbishi think it made an pattern of prtinting two sqr then two cub and so on but anyway the point is that it saves time
@LucasvanOsenbruggen
@LucasvanOsenbruggen 7 лет назад
This channel deserves more subscribers. I has a lot of explanations of great quality.
@drcvagos-iu
@drcvagos-iu 6 лет назад
totally agree!
@gilbertngeywo3664
@gilbertngeywo3664 6 лет назад
True
@codebasics
@codebasics 5 лет назад
Step by step roadmap to learn data science in 6 months: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-H4YcqULY1-Q.html Learn data science with pandas: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-CmorAWRsCAw.html Machine learning tutorials with exercises: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-gmvvaobm7eQ.html
@letsbye
@letsbye 6 месяцев назад
wish you could remove the BG music, it doesn't make learning any more pleasant, if any, its jus distracting...!!
@starbound03
@starbound03 5 лет назад
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
@codebasics
@codebasics 5 лет назад
Yes python is indeed the most easiest language to learn , especially if you are just starting out.
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@sugarhady
@sugarhady 7 лет назад
Thank you, sir ! This is the best and the simplest explanation I have found on youtube.
@BINUKITTOOP
@BINUKITTOOP 5 лет назад
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...!
@lawlietnao_music
@lawlietnao_music 5 лет назад
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.
@yoddha24
@yoddha24 6 лет назад
Very nice tutorial. Many thanx for making my concepts clear. I saw all these video continuously for 3 hours. I just wish to comment on one minor detail. For each of four numbers, loops wait for 0.2 seconds i.e one loop waits for 0.8 seconds so two loops will wait for 1.6 seconds which is the total time of execution! Without the waiting time the numbers for time would have been very small to be noticed. This could have been mentioned by the author.
@victorbhattacharjee3782
@victorbhattacharjee3782 Год назад
Thanks Sir. I have checked your website and gone through your details. You are such a nice person and spreading knowledge freely. This kind of attitude defines humanity is still there for such people as me who have nor enough ability to buy any premium course. I am from Bangladesh. Sir Thanks
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@fionatsang4699
@fionatsang4699 5 лет назад
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
@codebasics 5 лет назад
Fiona, I am glad you liked the busy mom analogy 😊
@shifaabid1425
@shifaabid1425 2 года назад
Why more people aren't still subscribing to this channel? There's called something, GRATITUDE....
@jamaicandjnado
@jamaicandjnado 7 лет назад
AMAZING, thank you so much, by far the easiest example on RU-vid that i have seen. Make your functionality THEN thread them
@hezlean
@hezlean 7 лет назад
Great work ! Finally a clear and simple introduction video to multithreading ! Thanks ! Keep up the good work !
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@prayagduttsharma5802
@prayagduttsharma5802 7 лет назад
simplest and the best multi threading explanation ! Thanks!
@Richard_GIS
@Richard_GIS 6 лет назад
Thank you so much for stepping behind the idea of multiprocessing and threading in python. Thx
@antropology721
@antropology721 6 лет назад
it's really clear literate explanation from the methodical point of view
@chlikhita2531
@chlikhita2531 8 месяцев назад
Very well explained! Thank you so much!
@boratsagdiyev3936
@boratsagdiyev3936 5 лет назад
codebasics, everyone loves you this is awesome.
@codebasics
@codebasics 5 лет назад
Captain radd, thanks for your kind words of appreciation 😊
@DaviAreias
@DaviAreias 2 года назад
Thanks, I spent a lot of time thinking about on how to do something like this, thinking I'd need a CS major to figure it out, but you've explained it very well in 10 minutes.
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@kerron_
@kerron_ 6 лет назад
Very simple an Straight to the point example
@vishwa4908
@vishwa4908 6 лет назад
crystal clear with real-world example
@sudhadevi3211
@sudhadevi3211 4 года назад
I like the way you explain...simply superb!!!
@codebasics
@codebasics 4 года назад
Thanks Sudha.😀
@kushalneo
@kushalneo 6 лет назад
This channel is awesome. Thanks for teaching in great and easy manner.
@Jdjdhsgxuxu
@Jdjdhsgxuxu Год назад
Thank you so much, you are so good at what you do.
@computervisiondev
@computervisiondev 6 лет назад
Amazing explanation! Thank you so much!
@Shinykip
@Shinykip 7 лет назад
Yet another clear and concise tutorial video from you. Well done!
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@awaisahmed6976
@awaisahmed6976 2 года назад
Great demonstration of concept and example.
@mr.anonymous298
@mr.anonymous298 Год назад
Thanks sir, easy & nice explanation
@fahimbakhtiar
@fahimbakhtiar 7 лет назад
clear and concise!! great explanation
@dicktrolington416
@dicktrolington416 6 лет назад
Fahim Bakhtiar I agree, this is jusy what I was looking for.
@DrZeeshanAli
@DrZeeshanAli 7 лет назад
i have seen so many videos, your explainations are outstanding and simple. Keep up the good work bro !!!
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@adimasmudi5390
@adimasmudi5390 3 года назад
Very nice explanation and analogy sir, thanks
@codebasics
@codebasics 3 года назад
👍😊
@ivano.5249
@ivano.5249 5 лет назад
Absolutely great explanation and useful material. THANKS A LOT!
@bhawin101283
@bhawin101283 4 года назад
Good job man. Specifically, real examples you use are always interesting. 😀😀😀
@codebasics
@codebasics 4 года назад
Thanks Bhavin! 😃
@dsdridi5362
@dsdridi5362 3 года назад
Hoi , Hier Mom is making multi tasks at the same time , but i see in Multithreading --> steping from one task to the other { AND NOT DOING LIKE MOM } ( 1.execute 1st part fonction n1 then execute 1st part fonction n 2 - 2. execute 2d part fonction n1 then execute 2d part fonction n2.............. making a for loop between 2 fonctions with a 2 X nested loop OR NOT ?? if u comment # time.sleep(0.2) it will be done in 0.0 second but fonction n2 have to wait till fonction one is done // like i said befor i' m new in this programmer world with Zero exprerience , please correct me if i m wrong . Nice done Professor , LOVE UR CHANNEL 😍 by the way = I start today ur step by step roadmap to learn data science in 6 months , I hope to get it ( i m a 41 years old man 😁 with kids ) is not easy to have more then one hour a day free for it
@tamilarasi2225
@tamilarasi2225 6 лет назад
If i have two threads, Is it possible to start a thread only after getting some signal from other thread?
@muhammedcanozdemir6447
@muhammedcanozdemir6447 25 дней назад
Actually, there is no need to front method, we can handle it with dequeue method. just hold the dequeued thing to a variable and print it after that you can do string manipulation
@DL190695
@DL190695 10 месяцев назад
Hello. I believe it’s misleading when you say “in parallel”. In parallel would be if you are using multiple cores (so multiprocessing). I believe the proper term to use here is “concurrently”. What do you think @author?
@kewtomrao
@kewtomrao 4 года назад
Your explanation on threading was awesome!!
@codebasics
@codebasics 3 года назад
Glad it was helpful!
@OttosTheName
@OttosTheName 5 лет назад
Thank you! Great explanation, easy to follow. This will help my little project a lot!
@codebasics
@codebasics 5 лет назад
OttoNL, I am happy this will be helpful in your project 😊👍
@durbish
@durbish Год назад
@codebasics - why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@newlinks883
@newlinks883 3 года назад
great explanation
@vamsichava5573
@vamsichava5573 7 лет назад
Simple example great knowledge ...!! Keep it up
@octo314
@octo314 7 лет назад
Thank you for this video, very good explanation, very helpful!
@kostasnikoloutsos5172
@kostasnikoloutsos5172 7 лет назад
I love this video!
@mchandresh
@mchandresh 7 лет назад
why did i reach here so late :-( this is really the best tutorial
@汪桓生
@汪桓生 Год назад
If two time.sleep(0.2) lines are removed, are you still getting 50% computation time saving??
@kathirangamuthu3574
@kathirangamuthu3574 2 года назад
Thank you very much.
@vballworldcom
@vballworldcom 7 лет назад
Thank you, great stuff! But the music is a bit distracting...would you be able to remove the music in the future vids? Keep giving the people what they want...
@jonathanmeza5807
@jonathanmeza5807 3 года назад
idk why, but the background music makes this video sooo much easier to understand
@HollyPeck
@HollyPeck 5 лет назад
"mom is doing multi-threading"
@shreehari2589
@shreehari2589 3 года назад
True that
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@mehdihachimi9624
@mehdihachimi9624 5 лет назад
Amazing explanation thank you !!
@codebasics
@codebasics 5 лет назад
You're welcome.
@adventureswithdavedave
@adventureswithdavedave 7 лет назад
This sir, is a fantastic and easy to understand tutorial. I appreciate you keeping it simple.
@durbish
@durbish Год назад
why it printed two squares at 8:56 back to back and two cubes at 8:59 ?
@adventureswithdavedave
@adventureswithdavedave Год назад
​@@durbish the printed output from threads can seem out of order since they run independently. There's probably more going on under the hood as there might be delays getting the printed output to the main thread. But it's pretty common
@abheykalia3409
@abheykalia3409 2 года назад
In CPython, the interpreter enforces a Global Interpreter Lock which basically means that at any given instant only one thread of a py program is allowed to run. So multithreading is just an illusion in python because the CPU is just using context switching to run the multiple threads.
@codebasics
@codebasics 2 года назад
It is not a complete illusion. For io bound operations (reading a file etc) it still works as expected
@NuevoVR
@NuevoVR 6 лет назад
Wow you just made it so easy to understand thanks
@NuevoVR
@NuevoVR 6 лет назад
Subbed
@starman8505
@starman8505 2 года назад
if we have not added that 0.2 then it will not wait and complete the square arr completely first and then cube but in less or same time as 0.8, Its not multi threading but if we see from the time saving point then its the same , multi threading will not be required in this examples if you remove 0.2 , just my thoughts. Multitasking is awesome for the examples you said like CPU is waiting for the data etc , when CPU is idle.
@naveenthattil6715
@naveenthattil6715 6 лет назад
Thanks for the explanation. Very clear.
@codebasics
@codebasics 4 года назад
I am glad it was helpful
@echavez10k
@echavez10k 4 года назад
if i want to get data from t1, in case t1 was in another class, how i can get that data
5 лет назад
Thanks for sharing! Good video!
@codebasics
@codebasics 4 года назад
I am glad it was helpful
@bsBakchodi
@bsBakchodi 6 лет назад
When I am using threading time is incresing !
@mahanirvaantantra
@mahanirvaantantra 3 года назад
same for me. it is taking 2 micro seconds whereas w/o threading it takes 1.6 microsec.
@srinivasboppu6230
@srinivasboppu6230 7 лет назад
Amazing video. Simple and Clear. What are the two advantages that prevents? Can you point me to the advanced video which you were referring to at the end of the video?
@stickmouse5002
@stickmouse5002 5 лет назад
wait. you are violating copyright YOUR CHANNEL LOGO IS THE CODE.ORG ONE apart from that, keep up the good job
@williammartin4416
@williammartin4416 5 месяцев назад
Thanks!
@stumblinzz
@stumblinzz 7 лет назад
Thanks for the video!
@roseanne1105
@roseanne1105 6 лет назад
Thank you, this was very well explained!
@codebasics
@codebasics 4 года назад
I am glad it was helpful
@SlavaBatyrev
@SlavaBatyrev 6 лет назад
Great stuff. thank you!
@shritamkumarmund5273
@shritamkumarmund5273 6 лет назад
Can you please explain this. Here t= time.time() and in the " done it" line we subtract time.time() by t. Which means it should be Zero. But how it's giving the exact output.
@rashidcodes4291
@rashidcodes4291 6 лет назад
great explanation👌🏾👏🏾
@kgottsman
@kgottsman 7 лет назад
Excellent explanation
@sambathnarayananparthasara8621
@sambathnarayananparthasara8621 4 года назад
Teaching CS through story telling ! Brilliant that is the way to ...
@codebasics
@codebasics 3 года назад
I am happy this was helpful to you.
@karimmohamed7725
@karimmohamed7725 7 лет назад
Nice explanation , Thank you
@sanooosai
@sanooosai 6 месяцев назад
thank you
@BM-uf4pp
@BM-uf4pp 7 лет назад
very clear, thank you
@khoasdyn284
@khoasdyn284 6 лет назад
How can I store that values ( the results of cubed and squared numbers)? In the tutorial, he just print the results on the command.
@CodingMazaa
@CodingMazaa 5 лет назад
Very good tutorials!
@MrNhosseini
@MrNhosseini 2 года назад
In Exercise 1, the second function has an infinite while loop, this loop could be helpful once we are working on stream data, but for this example we can use 'while food_order_queue.size()>0' cannot we?
@rahuljangir2843
@rahuljangir2843 3 года назад
in "print("done in : ",time.time()-t)", why we here using "-t", anyone can explin me ?
@sameeruddin6228
@sameeruddin6228 4 года назад
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 ...
@sameeruddin6228
@sameeruddin6228 4 года назад
ok I solved the problem i made a mistake .....i put sleep at wrong place....
@codebasics
@codebasics 4 года назад
Sameer I am glad you figure it out. Good job buddy 💪👌👍
@tushartupe6521
@tushartupe6521 2 года назад
Thank you sir
@memoryinwind
@memoryinwind 6 лет назад
why do I get the numbers all bundled together. I use IDLE by the way. square: cube: 48 square: cube: 918 square: cube: 64128 square: cube: 81162
@AliKhan-ku3tf
@AliKhan-ku3tf 5 лет назад
Same error with me
@Ullashpodder
@Ullashpodder 5 лет назад
anyone thinking about the return value of the function, it seems easiest way is either introducing Queue or using Threadpool!
@harshalshedolkar2909
@harshalshedolkar2909 4 года назад
Hey, can we use multi-threading to speed up our prediction through model? If that's possible, can you tell how to do that?
@charmilam920
@charmilam920 3 года назад
What is GIL and how does it effect multi threading Can you please make a video on it ?
@drcvagos-iu
@drcvagos-iu 6 лет назад
this is an amazing tutorial :) thank you,
@Revention95
@Revention95 6 лет назад
Nice tutorial thank you!
@vijayodedara5316
@vijayodedara5316 7 лет назад
A well Explained example. A Question: What will happen if two functions are sharing variables?
@RinksRides
@RinksRides 7 лет назад
thread should be locked, Derek Banas also has a good video on threading that explains thread locking.
@saimanoj2780
@saimanoj2780 3 года назад
can we pass a object or methods in target under multiprocessing ?
@luccaszulliane6024
@luccaszulliane6024 5 лет назад
Thanks, man, indeed really good tutorial!
@codebasics
@codebasics 4 года назад
I am glad it was helpful
@prashlovessamosa
@prashlovessamosa 2 года назад
Thanks man
@sytan64199
@sytan64199 5 лет назад
Great tutorial.
@mackblack8525
@mackblack8525 5 лет назад
Thank u so much India
@laurisskraucis2247
@laurisskraucis2247 6 лет назад
Really nice explanation, thanks!
@codebasics
@codebasics 4 года назад
I am glad it was helpful
@qzorn4440
@qzorn4440 7 лет назад
wonderful information. thanks.
@AnExperimentWithSelf
@AnExperimentWithSelf 5 лет назад
Great tutorial. Thank you so much
@codebasics
@codebasics 5 лет назад
Glad you liked it sawani 😊👍
@Kramlets
@Kramlets 7 лет назад
Thank you! This helped a lot.
@codebasics
@codebasics 3 года назад
I am happy this was helpful to you.
@zahidadeel25
@zahidadeel25 7 лет назад
very helpful. Thanks
@curtturdle5661
@curtturdle5661 7 лет назад
very helpful. you earned a sub.
@curtturdle5661
@curtturdle5661 7 лет назад
i did. i'm going to go through the whole course.
@curtturdle5661
@curtturdle5661 7 лет назад
will do. btw i cant stand the background music lol.
@FirstNameLastName-fv4eu
@FirstNameLastName-fv4eu 7 лет назад
Amazing brother!!!
Далее
Python Tutorial - 27. Multiprocessing Introduction
8:17
threading vs multiprocessing in python
22:31
Просмотров 578 тыс.
PLEASE Use These 5 Python Decorators
20:12
Просмотров 111 тыс.
2 Years Of Learning C | Prime Reacts
22:24
Просмотров 281 тыс.
Understanding Python: Multiprocessing
21:50
Просмотров 4,2 тыс.
If __name__ == "__main__" for Python Developers
8:47
Просмотров 400 тыс.
Difference between Multiprocessing and Multithreading
4:07
Unlocking your CPU cores in Python (multiprocessing)
12:16
#64 Python Tutorial for Beginners | MultiThreading
14:45
Using tkinter with classes
28:23
Просмотров 63 тыс.