Java Memory Model in 10 minutes
HTML-код
- Опубликовано: 28 май 2024
- Java Memory Model is a set of rules all JVMs have to follow to ensure correct working of our concurrent programs.
More resources:
2016.javazone.no/program/the-...
shipilev.net/blog/2014/safe-p...
www.cs.umd.edu/~pugh/java/mem...
docs.oracle.com/javase/specs/...
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.
Subscribe or explore the channel - / defogtech
New video added every weekend.
Popular Videos
----------------------------------
What is an API Gateway - • What is an API Gateway?
Executor Service - • Java ExecutorService -...
Introduction to CompletableFuture - • Introduction to Comple...
Java Memory Model in 10 minutes - • Java Memory Model in 1...
Volatile vs Atomic - • Using volatile vs Atom...
What is Spring Webflux - • What is Spring Webflux...
Java Concurrency Interview question - • Java Concurrency Inter... - Наука
I'm going through this playlist to learn Java concurrency, and I have to say your explanation and presentation quality are amazing, and the diagrams are really helpful.
thank you!
Wow, thanks!
@@DefogTech Why no videos from you😔?? All your subscribers are waiting
Always read these topic therotically, but could never visualise it like this you have explained..Great presentation man!
I have never seen such an excellent explanation of JMM. Thanks a lot
I would absolutely recommend all Java engineers-whether junior or very senior-to watch this!
I tried multiple times myself to understand JMM,
But this is the first time i got to learn something about them.
Excellent Presentation.
Hats of to you, You define perfection!!
I am far from perfect. Though, thanks much for the kind words sir!
May be you should read java language specification : docs.oracle.com/javase/specs/jls/se8/html/jls-17.html .
I had an interview question like that.. This is a very clean explanation , keep doing it!
The best video i could find on youtube.
This helped me understand a lot about the JVM Thanks, you're very good at explaining things without any unneeded gibberish!
Your explanations are precise, but have so in-depth/hidden informations and moreover so easy to understand
Man, you are awesome. I was struggling trying to understand atomic operations and the use cases of volatile variables. Thank you so much
Very concise and easy to grasp. Great job!
My takeaway - if the tasks perform blocking IO operation, I should not use fork join pool. so true. Thanks for the explanation! You have a gift of mixing complicated concept easy to digest!
You have a good teacher in you. Please continue the good work.
Awesome clarity. Voice is very clear and videos are well designed. Subscribed 👍
Awesome mate. You are really doing great, very impressive
Wow…. Such an well articulated video. I felt this topic to be very difficult to understand before I watched your video. Please sir keep adding more and more topics to this channel. For the first time fell in love with subject videos.
Crystal clear explaination... Loved it
Honestly exceptionally well explained Sir, hats off
Please make a whole course...I will definitely try buying it.Your videos are just awesome.
Best explanation I've seen, great work!
future me:
volatile has semantics for memory visibility. Basically, the value of a volatile field becomes visible to all readers (other threads in particular) after a write operation completes on it. Without volatile, readers could see some non-updated value.
Awesome video...Please don't stop making such excellent videos.
Thank you for the motivation sir!
Please make more videos
Defog Tech More videos :)
More videos pleaseeeee
Started watching thread pool videos Nd then addicted to all of ur videos Nd subscribed..the way of explanation is precise , innovative Nd interesting.your wrk deserves more than a thnks..
Thank you for the kind words!! I am so happy its helping everyone
Yes are techie by heart
This video is pure GOLD!!!
Really loved the explanation. Thank you
Best explanation of volatile so far... 👌
This playlist you have made is too awesome. your example/explanation for happens-before has a few issues. Not sure if I understood wrong, otherwise.Thank you so much for this playslit.
You are my interview trainer...love you bro:)
Very nicely explained. Please keep making such videos.👍👍
Best video on java on whole RUclips universe
Amazing presentation. All the videos are really helpful. Great work.
Great video, very clear explanation and examples. Thank you
That was really good. Thanks for posting, excellent, clear and to the point presentation, good job!
Thank you
Thanks for sharing this concept. I had only some theoretical knowledge of this before I watch this imp video.
Videos are very useful. Crisp & Clear. I request to make more videos
this channel deserve much more subscribers.
Dude!! You are awesome, a true lifesaver. You are the first that have made it simple, at least that I have come across
Thanks much buddy!
love your simple examples. thank you
U earned a fan today - Subscribed !
This is one ultimate video...subscribed !!
Very nice explanation appreciate it, thanks.
Explanation is very good and sharp!
You are a fantastic teacher.. please please make more videos
Bro You are simply amazing. You may be not realised how much you are helping us. Thank You bhai :D
everything to the point.. love ur videos bro❤️
Hey great videos as always! I just wanted to ask, since primitives are passed by value and Objects are passed as reference, does the JVM only cache primitives into a threads local cache? If the value being updated was an Integer Object, e.g. new Integer(1), it would not need flushing as the object is passed by REFERENCE?
I have been going through a lot of JAVA topic videos in different forums, by far Defog Tech is the best that I have come across. Advanced topics explained in a simple way which provides clarity. Keep going
Thank you for the kind words sir!
Thanks for a proper explanation on happens-before 🙂
Best explanations! Keep it up.
Jigger u r love...
Awesome video....
Amazing teaching skills... Thanks a lot
Thank you for nice explanation and make more videos.
You're just brilliant! 🙏🏽
Very good and simple explanation
Learnt new information..thank you so much
Awesome explanation and examples!
Excellent explanation. Thank you
Very good and crisp way of explanation. Keep doing this good :) work
Thank you!
2:50 loved this diagram man.
very simple to understand
This video is excellent.
Good explanation !! :) Very usefull
Thank u, waiting for more videos on java
Awesome explanation buddy. thanks a lot. :)
Oh thanks man. I wish you were my lecturer 😀
Hi, Thanks for the video.
How is the volatile or synchronized or lock usage different from having the field in the constructor?
Can't the shared cache object be used by putting the field in the constructor method and calling it in different threads?
You are doing Great! Dude
Thank you very much sir!! You are amazing ❤️
🙏 You are the Best Teacher that I have ever seen.🥇, A classical method of approach = Superb indeed.👌.🎯Please Could you kindly teach us Flutter & Dart & Go lang & Scala too . Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeese Sir..... 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Great tutorial, thank you SIR!
You're very welcome!
Super explanation 👍
Short and Sweet
2:10 each core has its own cache and then there are shared caches. Thread running on core changes the variable in its local cache only, volatile keyword makes sure variable is flushed to shared cache when thread changes it so that changes are visible to all the other threads
6:05 happens before relationship
9:30 volatile keyword example
Hi can you help me
I am confused when i was trying real time as per the diagram in the time 00:03:52
here i used this...
System.out.println("the writerThread x is: "+x);
System.out.println("the readerThread r2 is:"+r2);
---------------------------------------------------------------------------------------------------------------------------------
like in this program(below):
public class FieldVisibility
{
int x = 0;
public void writerThread()
{
x = 1;
System.out.println("the writerThread x is: "+x);
}
public void readerThread()
{
int r2 = x;
System.out.println("the readerThread r2 is:"+x);
}
}
output is:--
the writerThread x is: 1
the readerThread r2 is:1
.......................................................................................
instead of
the writerThread x is: 1
the readerThread r2 is:0
Excellent explanation
Very good video, thank you!
Awesome. Thanks man!
Amazing!!! You rock!
Thank you! Really like your explanation.
You're welcome! I'm happy you liked it
Very good content 😊
nice explanation
Awesome dude... Helped a lot
Glad it helped. Thank you!
Please do more such videos
Awesome. Expected more videsos 👌👌👌
Thank you sir!
Could you make a samples of reactive programming followed by your aka Java fiber videos. For eg, How to use RxJava for the below categories of apps,
1. Considering both frontend and backend
2. Considering there is no frontend and it's purely backend app.
Doing good job. Really great👍
Superb video
Hi,
I have one request if you could make a video on Performance improvement techniques. Not necessarily related to threading but in general.
I am sure everyone would be benefited as you explain complex things in very simple way :)
Sure, sounds like a good idea. Will add it to the list
read write barrier means what sir please explain if we use volatile what happens to those barriers
Who the hell dislikes such a great videos??
other video makers :)
Awesome explanation mate. God bless you
In my case there is concurrent hashmap obj that holds configurations read from different server.
Quartz scheduler will fetch configuration data for every 30 sec and update a new data (whole obj) to this concurrent hashmap..
In this case ,in my opinion voltaile should be used to always get the updated obj to the reader threads but some quality checking tools raising it as bug
So any suggestions during this scenario
So if two threads are runing in one core, there is no need to use volatile keyword because they share same cache?
Awesome video... Can u also make video on design patterns ...?
Explaination with L2 and L3 is so deep. How do you get so deep
Super video! I applauded for ₹40.00 👏
good job, man!
Superb!
Your the best man 😀
Great video
Really good explanation with a good visual display of those
can you please make a video on working of JVM and its architecture? btw good job.
Can Volatile keyword be used with HashMap in any where code snippet. If yes, how to do that?