Optimistic Locking - What, When, Why, and How?

  Рет қаралды 16,450

Arpit Bhayani

Arpit Bhayani

Күн бұрын

Пікірлер: 29
@abdulwakeel6363
@abdulwakeel6363 Жыл бұрын
This channel has enough content to become a senior backend engineer who are at beginner or mid senior level. Thank you Arpit so much
@cooldudecs
@cooldudecs Жыл бұрын
My goal is Staff is so this has been great , even for references to modeling what already is out there rather than re inventng the wheel. Thanks!
@thegreekgoat98
@thegreekgoat98 Жыл бұрын
Hey Abdul, can you please tell me where to start. Right now I have just passed out in 2023, and joined a company as a backend developer.
@sandy4799
@sandy4799 8 ай бұрын
This is really awesome. Got satisfying answers for the doubts I had on contention for CAS operation by two threads. If one wants to be like him your thinking should be like DFS graph traversal, keep digging the problem deeper until all your doubts are resolved.
@jaimalad2902
@jaimalad2902 Жыл бұрын
Great teaching technique. Awesome videos. There lot of senior engineers but very few of them has such great teaching skill like arpit
@rahulkapoor7305
@rahulkapoor7305 11 ай бұрын
In optimistic locking there is a concept of Time-of-check to time-of-use when we are checking the old value to be old value => so that we can write it to the new value. there can be another thread which will actually update it in the time being of this checking and updating. and current thread might be a case of also picking up old value = old value. here the race condition might occur
@samworldpk
@samworldpk 8 ай бұрын
Please help me in this scenario, If my app is load balanced and I have 2 nodes running under it. When 2 requests arrived to update the same resouce. How can Optimistic Locking works? There will be 2 machines and each can execute compare_and_swap or (TOC and TOU) same time.
@vaishnavpureddiwar3091
@vaishnavpureddiwar3091 21 сағат бұрын
Thanks Arpit
@bhanuarora4504
@bhanuarora4504 9 ай бұрын
Amazing content, these internals are very interesting, thank you so much arpit
@aditya7955
@aditya7955 Жыл бұрын
Quick question around cpu context switch. Most CPU’s have multiple cores and this comparison function would be running on a single core. Does that mean other cores are also at halt for the time being or they can execute a parallel thread?
@AsliEngineering
@AsliEngineering Жыл бұрын
It depends on the architecture. Some block the cores, while other block the memory location.
@joobis.b4568
@joobis.b4568 Жыл бұрын
@@AsliEngineering had this question in mind, thanks for clarifying
@SomeshSharma-z4z
@SomeshSharma-z4z 4 ай бұрын
@AsliEngineering In the architecture where the other cores gets blocked, Are we using locks (if yes then won't it be a pessimistic approach)? And how is it implemented?
@prashantgupta6160
@prashantgupta6160 Жыл бұрын
Amazing bro, learned a lot
@nehagour6928
@nehagour6928 2 ай бұрын
Wow explanation Arpit
@AsliEngineering
@AsliEngineering 2 ай бұрын
Thanks Neha!
@advaitpundlik8797
@advaitpundlik8797 Жыл бұрын
Great Video !!! I wonder how do you choose your content and what resources you used to learn fundamental concepts in multithreading ? Really Great Work and I look forward to every new video.
@ashishsinghchauhan6304
@ashishsinghchauhan6304 Жыл бұрын
Good tutorial Arpit sir.
@samworldpk
@samworldpk 8 ай бұрын
Please help me in this scenario, If my app is load balanced and I have 2 nodes running under it. When 2 requests arrived to update the same resouce. How can Optimistic Locking works? There will be 2 machines and each can execute compare_and_swap or (TOC and TOU) same time or a race condition may be.
@LeoLeo-nx5gi
@LeoLeo-nx5gi Жыл бұрын
Thanks a ton, it was quite clear!!
@queenslayerthefifth1771
@queenslayerthefifth1771 6 ай бұрын
Why loading the count variable is atomic?
@charan775
@charan775 2 ай бұрын
what about using pessismistic locking + skip locked? this will help in threads not getting blocked right?
@AsliEngineering
@AsliEngineering 2 ай бұрын
Yes. It will, but it should suit your usecase. Because not everytime you can skip locked rows.
@shishirchaurasiya7374
@shishirchaurasiya7374 Жыл бұрын
Today, I realised going through the content only once is not enough, as a human we loses many important points, finally completing this series for the 2nd time 😍😍 and what I am feeling right now I can't even express, feeling like I can be a TEAM LEAD 😅 at this time by knowing these little little minute details
@ShubhamVarshney-o7c
@ShubhamVarshney-o7c 9 ай бұрын
arpit bhaiya ji please recommend a book to learn all of these CPU instructions and also linux commands for accessing process control blocks
@sachinpandhare5143
@sachinpandhare5143 Жыл бұрын
Nice! But example is misleading, if goal is to just increase the count, then atomic increment is a better choice, better example for compare and exchange would be implementing mutex itself or spinlock, correct me if I am wrong :)
@rajatmehta8499
@rajatmehta8499 Жыл бұрын
This CaS operation is used in lmax disruptor too
@SaketAnandPage
@SaketAnandPage Жыл бұрын
Using complex variable name.
@Xresus
@Xresus Жыл бұрын
Bro Hindi mein Bana sakti ho ,agar ATI ho to English mein content bhaut hai youtube par Par Hindi mein kam😅
Database Sharding and Partitioning
23:53
Arpit Bhayani
Рет қаралды 107 М.
Peeking into assembly code to understand why count++ is not atomic
14:12
Ozoda - Alamlar (Official Video 2023)
6:22
Ozoda Official
Рет қаралды 10 МЛН
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
Why do databases store data in B+ trees?
29:43
Arpit Bhayani
Рет қаралды 47 М.
Load Balancers are not Magic - Dissecting Atlassian Outage
13:07
Arpit Bhayani
Рет қаралды 19 М.
How do indexes make databases read faster?
23:25
Arpit Bhayani
Рет қаралды 78 М.
The Genius Way Computers Multiply Big Numbers
22:04
PurpleMind
Рет қаралды 192 М.
Dependency Injection | Prime Reacts
28:34
ThePrimeTime
Рет қаралды 364 М.
How to write deadlock free code?
21:11
Arpit Bhayani
Рет қаралды 9 М.
This is why understanding database concurrency control is important
9:05
Ozoda - Alamlar (Official Video 2023)
6:22
Ozoda Official
Рет қаралды 10 МЛН