Locking & Synchronizing Threads in Python

  Рет қаралды 21,060

NeuralNine

NeuralNine

Күн бұрын

Пікірлер: 17
@scottlee38
@scottlee38 2 жыл бұрын
Yes. Thanks! We need more "Threading" videos!!
@SulemanAsghargoion
@SulemanAsghargoion 2 жыл бұрын
If you acquire lock using with statement. It will make sure lock will always be released.
@ΑρηςΕμπαντα
@ΑρηςΕμπαντα Жыл бұрын
I didnt get it... First we had synchronous code. Then we deployed threads to do things concurrently (awesome for I/O bound tasks), and then with locking we made the code synchronous again? For what you want to perform, either multiprocessing can help you, or to switch to other programming language like C# or Java that actually runs threads in parallel.... Why doesn't nobody else in the comment section address that stuff?
@tomekk.1889
@tomekk.1889 Жыл бұрын
I don't understand what you mean. Locking is used so there's no race conditions between the threads. His example wasn't good though. He should have explained it using producers and consumers
@monishsudhagar
@monishsudhagar Жыл бұрын
Yeah, just bad use case. When you work with produces and consumers or any multithreaded application with a shared state, then locking starts to make sense
@hams6468
@hams6468 11 ай бұрын
Locking is useful if for example - you have to make an API request to pull some data & then cache it. You simply lock so that a thread can go and pull data from an api & cache it, then all other threads can use that cache.
@chriskeo198
@chriskeo198 2 жыл бұрын
best video on threading!
@iniyan19
@iniyan19 2 жыл бұрын
thanks !!! i was searching for this!!!
@scottlee38
@scottlee38 2 жыл бұрын
I ran into this same issue with thread locks. Wish there was a way to get around it so that I could keep threads for certain loops "always running".
@ilanbar1970
@ilanbar1970 2 жыл бұрын
Well explained. Thanks!
@BrianStDenis-pj1tq
@BrianStDenis-pj1tq 2 жыл бұрын
You pretty much said Python doesn't have multi-threading, presumably due to the impact of the GIL. I'd say that Python does have multi-threading, and the GIL. Which means that for CPU bound threads, its very similar to having a single CPU. But, for I/O threads, it works great.
@ΑρηςΕμπαντα
@ΑρηςΕμπαντα Жыл бұрын
You just can use multiprocessing if you have a 4 core CPU to do 4 CPU bound tasks in paralel... But true for I/O tasks python threads are great
@DG-mo1nw
@DG-mo1nw 2 жыл бұрын
Thanks for the videos been learning a lot. Is there any way you could do a video using tradingview webhooks for indicators for a trading bot using python?
@good-oe2cz
@good-oe2cz 9 ай бұрын
it was a bit rough explanations. with better example and concept of context change, it would be a better explanation. thank you for your video.
@peperomero4603
@peperomero4603 6 ай бұрын
bravo!
@pawelek1481
@pawelek1481 2 жыл бұрын
Lets make your connection pool
Python Intermediate Tutorial #4 - Synchronizing Threads
14:51
NeuralNine
Рет қаралды 36 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 12 МЛН
كم بصير عمركم عام ٢٠٢٥😍 #shorts #hasanandnour
00:27
hasan and nour shorts
Рет қаралды 10 МЛН
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
Como eliminar FRP con programa gratuito
9:11
EL HACKER DE LAS MAQUINITAS
Рет қаралды 10
Unlocking your CPU cores in Python (multiprocessing)
12:16
mCoding
Рет қаралды 309 М.
threading vs multiprocessing in python
22:31
Dave's Space
Рет қаралды 593 М.
SAFE Multithreading with Mutex Locks
7:51
bvdl․io
Рет қаралды 3,7 М.
Learn Python MULTITHREADING in 8 minutes! 🧵
8:43
Bro Code
Рет қаралды 12 М.
Synchronizing Multiple Processes in Python
9:31
NeuralNine
Рет қаралды 11 М.
Thread Pools in Python - Asynchronous Programming
10:25
NeuralNine
Рет қаралды 31 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 815 М.
Multithreading in Python | Thread synchronisation and Locking
11:41
Cognitive Programmer
Рет қаралды 9 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 12 МЛН