Using volatile vs AtomicInteger in Java concurrency

preview_player
Показать описание
When to use volatile, and when to use Atomic counterparts like AtomicInteger? What are the advantages and use cases of each?

Channel
----------------------------------
Complex concepts explained in short & simple manner. Topics include Java Concurrency, Spring Boot, Microservices, Distributed Systems etc. Feel free to ask any doubts in the comments. Also happy to take requests for new videos.

New video added every weekend.

Popular Videos
----------------------------------
Рекомендации по теме
Комментарии
Автор

Not saying for the sake of saying but after visiting a lot of other channels I always come back to your videos for anything related to multithreading. You are simply awesome.

bhaaratsharma
Автор

"The Best Content" for concurrency in java. Thanks much!

rohithp
Автор

Hey man. I know this is already a 2year old video but I would like to express my thanks for putting these videos and I really learned a lot. Anything related to threads and concurrency in Java have been very intimidating for me and I always thought it's not important as I'm doing well in my current role in the company I'm working with. However, I realized my career as a software engineer is in rot due to not taking risks and for not taking on challenges by exploring what is out there for me.

I applied for Canva(spoiler: didn't got the job) and since then, I started watching your videos and practice coding related to java concurrency because it was advised on their role description. I'm still brokenhearted by the feedback that I didn't pass their first coding exam, hence, was not able to apply what I've learned from you. I'm still very thankful for what I've learned from your videos and made me more interested in this part of java.

Keep on making videos. Thanks!

dig
Автор

Done thanks

0:40 changing a variable in one thread will NOT reflect in the other thread. (Threads both have access to the variable, but each thread running on a different core the cpu has a local cache of the variable)

2:30 volatile solves visibility issue but doesn’t solve synchronization issues (when both threads are modifying the same variable, both could increment but the value is only +1 instead of +2)

4:50 solving synchronization with synchronized keyword

5:15 atomic variables provide atomic operations (incrementong happens as one operation instead of read then increment then write, where both threads could be running together)

6:30 which variables to make volatile and which values to make atomic

mostinho
Автор

Probably the most comprehensive explanation I've seen yet (recommend listening at 1.5x), thanks alot!

Kp
Автор

Clear and precise explanation...Best Ever!!! Plz Upload more core java concepts

swapnilankalkhope
Автор

Best Explanation, I have searched for volatile for so long, but understand here. Thanks

NikhilSawant
Автор

After reading hundreds of resources finally I got the answer her. How to and where to use Volatile and Atomic variables.

mukeshsinghdance
Автор

such a simple quick explanation. I keep coming on this channel for multi-threading concepts every once in a while

yadavankit
Автор

This is by far the best explanation of synchronization I ever seen, thanks for that!

chernanq
Автор

Perfect explanation!! I hope whoever watches this video, for sure they will get the idea of volatile and atomicInteger. Would you explain more about AtomicReference Class and its usage.

vijayakumarvj
Автор

It could not be more simpler. Thanks a ton.

jasper
Автор

This is the best that you can do in 7 minutes to explain these relatively confusing concept.

pandit-jee-bihar
Автор

i have 8 year exp and preparing for a major interview..all your videos are absolutely to the point. Cheers

gauravjoshi
Автор

2 main concepts explained in 7 minutes, hatsoff!!

hemalnakrani
Автор

I never seen this type of video how crystally explain each concept through out the example u have really gud command of mutithreading 👍🙏

pratapjavasingh
Автор

Your videos are awesome .The lucid manner in which the concepts are explained is of the highest quality. Please continue making videos and never slow down.

bhartisingh
Автор

Huge Salute/respect to you sir. I always first like the video before starting and then start watching.

contactdi
Автор

This is one of the clearest explanations I got about volatile and Atomic on the internet. Well done.

neerajmathur
Автор

The best video about the keyword volatile!! Hands Down

hareeshrajendran