Java Memory Model in 10 minutes

  Рет қаралды 254,318

Defog Tech

Defog Tech

Күн бұрын

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...

Пікірлер: 203
@70ME3E
@70ME3E 4 жыл бұрын
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!
@DefogTech
@DefogTech 4 жыл бұрын
Wow, thanks!
@mohammedrahamathulla4040
@mohammedrahamathulla4040 3 жыл бұрын
@@DefogTech Why no videos from you😔?? All your subscribers are waiting
@suhani091088
@suhani091088 4 жыл бұрын
Always read these topic therotically, but could never visualise it like this you have explained..Great presentation man!
@NaturalPro100
@NaturalPro100 5 жыл бұрын
The best video i could find on youtube.
@rohitsharma-xt8qe
@rohitsharma-xt8qe 5 жыл бұрын
I have never seen such an excellent explanation of JMM. Thanks a lot
@monishchhadwa777
@monishchhadwa777 4 ай бұрын
I would absolutely recommend all Java engineers-whether junior or very senior-to watch this!
@shellindebted5328
@shellindebted5328 6 жыл бұрын
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!!
@DefogTech
@DefogTech 6 жыл бұрын
I am far from perfect. Though, thanks much for the kind words sir!
@yifei663
@yifei663 5 жыл бұрын
May be you should read java language specification : docs.oracle.com/javase/specs/jls/se8/html/jls-17.html .
@TauCu
@TauCu 4 жыл бұрын
This helped me understand a lot about the JVM Thanks, you're very good at explaining things without any unneeded gibberish!
@Machinerium
@Machinerium 5 жыл бұрын
I had an interview question like that.. This is a very clean explanation , keep doing it!
@tanoysaha7410
@tanoysaha7410 4 жыл бұрын
Your explanations are precise, but have so in-depth/hidden informations and moreover so easy to understand
@mrchief3383
@mrchief3383 3 жыл бұрын
Man, you are awesome. I was struggling trying to understand atomic operations and the use cases of volatile variables. Thank you so much
@DrAkyla1123
@DrAkyla1123 5 жыл бұрын
Very concise and easy to grasp. Great job!
@bhavyashah2630
@bhavyashah2630 6 жыл бұрын
Awesome video...Please don't stop making such excellent videos.
@DefogTech
@DefogTech 6 жыл бұрын
Thank you for the motivation sir!
@gurupadamgundala5142
@gurupadamgundala5142 6 жыл бұрын
Please make more videos
@ITech2005
@ITech2005 5 жыл бұрын
Defog Tech More videos :)
@saravanprathi6956
@saravanprathi6956 3 жыл бұрын
More videos pleaseeeee
@sandeepkumarsahoo3458
@sandeepkumarsahoo3458 4 жыл бұрын
Crystal clear explaination... Loved it
@skaLife
@skaLife 4 жыл бұрын
You have a good teacher in you. Please continue the good work.
@viveksingh9120
@viveksingh9120 5 жыл бұрын
Awesome mate. You are really doing great, very impressive
@perrym8048
@perrym8048 5 ай бұрын
Best explanation I've seen, great work!
@Lucky-uz3je
@Lucky-uz3je 5 жыл бұрын
You are my interview trainer...love you bro:)
@kotojava
@kotojava 2 жыл бұрын
this channel deserve much more subscribers.
@purnimadas3762
@purnimadas3762 5 жыл бұрын
That was really good. Thanks for posting, excellent, clear and to the point presentation, good job!
@DefogTech
@DefogTech 5 жыл бұрын
Thank you
@vikramreddy7586
@vikramreddy7586 3 жыл бұрын
This video is pure GOLD!!!
@anilkinikar
@anilkinikar 5 жыл бұрын
Awesome clarity. Voice is very clear and videos are well designed. Subscribed 👍
@kakashihatake4840
@kakashihatake4840 6 жыл бұрын
Really loved the explanation. Thank you
@prashanttiwari120
@prashanttiwari120 3 жыл бұрын
Best video on java on whole KZfaq universe
@sumitbabel5415
@sumitbabel5415 3 жыл бұрын
Honestly exceptionally well explained Sir, hats off
@Admiral.MacDonnell
@Admiral.MacDonnell 4 ай бұрын
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!
@rajasruji2476
@rajasruji2476 2 жыл бұрын
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.
@gauravbajpai6890
@gauravbajpai6890 5 жыл бұрын
U earned a fan today - Subscribed !
@nlarralde
@nlarralde 3 жыл бұрын
Great video, very clear explanation and examples. Thank you
@Dedeepya9
@Dedeepya9 5 жыл бұрын
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..
@DefogTech
@DefogTech 5 жыл бұрын
Thank you for the kind words!! I am so happy its helping everyone
@sepraveen
@sepraveen 4 жыл бұрын
Yes are techie by heart
@edeepakjain
@edeepakjain 4 жыл бұрын
Best explanation of volatile so far... 👌
@tarang65
@tarang65 3 жыл бұрын
Amazing presentation. All the videos are really helpful. Great work.
@venu5791
@venu5791 4 жыл бұрын
Thanks for sharing this concept. I had only some theoretical knowledge of this before I watch this imp video.
@VikiSangani
@VikiSangani 5 жыл бұрын
Very nicely explained. Please keep making such videos.👍👍
@shobhitmittal77
@shobhitmittal77 4 жыл бұрын
This is one ultimate video...subscribed !!
@hakura88
@hakura88 Жыл бұрын
love your simple examples. thank you
@narendrasriram
@narendrasriram 5 ай бұрын
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.
@paneerdopyaaza2914
@paneerdopyaaza2914 3 жыл бұрын
Please make a whole course...I will definitely try buying it.Your videos are just awesome.
@jeremythen7239
@jeremythen7239 5 жыл бұрын
Best explanations! Keep it up.
@iknowyourerightbut6246
@iknowyourerightbut6246 5 жыл бұрын
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.
@ivanevseevv
@ivanevseevv 3 жыл бұрын
Explanation is very good and sharp!
@isayanpal
@isayanpal Жыл бұрын
You're just brilliant! 🙏🏽
@thomashpfner-dahl1433
@thomashpfner-dahl1433 5 жыл бұрын
Dude!! You are awesome, a true lifesaver. You are the first that have made it simple, at least that I have come across
@DefogTech
@DefogTech 5 жыл бұрын
Thanks much buddy!
@SatyaprasadMr
@SatyaprasadMr 4 жыл бұрын
Videos are very useful. Crisp & Clear. I request to make more videos
@mujahidshaikh5034
@mujahidshaikh5034 3 жыл бұрын
everything to the point.. love ur videos bro❤️
@noortech254
@noortech254 3 жыл бұрын
Bro You are simply amazing. You may be not realised how much you are helping us. Thank You bhai :D
@saravanprathi6956
@saravanprathi6956 3 жыл бұрын
You are a fantastic teacher.. please please make more videos
@StyleTrick
@StyleTrick 4 жыл бұрын
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?
@abhik9450
@abhik9450 4 жыл бұрын
Thanks for a proper explanation on happens-before 🙂
@umeriqbal5662
@umeriqbal5662 4 жыл бұрын
Jigger u r love... Awesome video.... Amazing teaching skills... Thanks a lot
@masteradityamishra9486
@masteradityamishra9486 5 жыл бұрын
Very nice explanation appreciate it, thanks.
@sshks10
@sshks10 3 жыл бұрын
Very good and simple explanation
@pogrommist
@pogrommist 3 жыл бұрын
Awesome explanation and examples!
@prasantkumar7693
@prasantkumar7693 5 жыл бұрын
Thank you for nice explanation and make more videos.
@vijayp6810
@vijayp6810 4 жыл бұрын
Learnt new information..thank you so much
@niftymiller6057
@niftymiller6057 5 жыл бұрын
Very good and crisp way of explanation. Keep doing this good :) work
@DefogTech
@DefogTech 5 жыл бұрын
Thank you!
@jiteshkumar3387
@jiteshkumar3387 3 жыл бұрын
Good explanation !! :) Very usefull
@vijaykumarreddyt3287
@vijaykumarreddyt3287 Жыл бұрын
You are doing Great! Dude
@ardiansyah6794
@ardiansyah6794 4 жыл бұрын
Oh thanks man. I wish you were my lecturer 😀
@harish7706
@harish7706 5 жыл бұрын
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
@DefogTech
@DefogTech 5 жыл бұрын
Thank you for the kind words sir!
@mehulmakwana7091
@mehulmakwana7091 4 жыл бұрын
Awesome explanation buddy. thanks a lot. :)
@MarkGla55
@MarkGla55 2 жыл бұрын
Excellent explanation. Thank you
@studio2038
@studio2038 4 жыл бұрын
very simple to understand
@ibrahimshaikh3642
@ibrahimshaikh3642 3 жыл бұрын
Thank u, waiting for more videos on java
@coreyhartman4510
@coreyhartman4510 4 жыл бұрын
This video is excellent.
@sbylk99
@sbylk99 5 жыл бұрын
Great tutorial, thank you SIR!
@DefogTech
@DefogTech 5 жыл бұрын
You're very welcome!
@andrii5866
@andrii5866 3 жыл бұрын
Awesome. Thanks man!
@__nitinkumar__
@__nitinkumar__ 2 жыл бұрын
2:50 loved this diagram man.
@sriram6148
@sriram6148 2 жыл бұрын
Amazing!!! You rock!
@manognajoshik8465
@manognajoshik8465 2 жыл бұрын
Thank you very much sir!! You are amazing ❤️
@gurupadamgundala5142
@gurupadamgundala5142 6 жыл бұрын
Awesome. Expected more videsos 👌👌👌
@DefogTech
@DefogTech 6 жыл бұрын
Thank you sir!
@MoBeigi
@MoBeigi 4 жыл бұрын
Very good video, thank you!
@Jayantch.999
@Jayantch.999 3 жыл бұрын
Super explanation 👍
@pkbkarpr
@pkbkarpr 3 жыл бұрын
Short and Sweet
@yxx5326
@yxx5326 5 жыл бұрын
Thank you! Really like your explanation.
@DefogTech
@DefogTech 5 жыл бұрын
You're welcome! I'm happy you liked it
@pradhumansingh1195
@pradhumansingh1195 3 жыл бұрын
Who the hell dislikes such a great videos??
@devendrawangikar2890
@devendrawangikar2890 3 жыл бұрын
other video makers :)
@tejasdoond7614
@tejasdoond7614 6 жыл бұрын
Awesome dude... Helped a lot
@DefogTech
@DefogTech 6 жыл бұрын
Glad it helped. Thank you!
@SagarBorseTheGeek
@SagarBorseTheGeek 5 жыл бұрын
Excellent explanation
@anugrah.singhal
@anugrah.singhal 3 жыл бұрын
Very good content 😊
@sivagurunathanparanitharan4714
@sivagurunathanparanitharan4714 4 жыл бұрын
🙏 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..... 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
@user-cf6ts2sc5x
@user-cf6ts2sc5x 3 ай бұрын
good job, man!
@studio2038
@studio2038 4 жыл бұрын
nice explanation
@Murga_Mutton
@Murga_Mutton 3 жыл бұрын
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?
@bluecomment6146
@bluecomment6146 2 жыл бұрын
Superb video
@kakashihatake4840
@kakashihatake4840 6 жыл бұрын
Please do more such videos
@suhaspartha2908
@suhaspartha2908 3 жыл бұрын
Superb!
@narendramanikanta7597
@narendramanikanta7597 5 жыл бұрын
Awesome explanation mate. God bless you
@mostinho7
@mostinho7 4 жыл бұрын
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
@monstersmiled648
@monstersmiled648 4 жыл бұрын
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
@ganeshpathak4804
@ganeshpathak4804 5 жыл бұрын
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 :)
@DefogTech
@DefogTech 5 жыл бұрын
Sure, sounds like a good idea. Will add it to the list
@khushbuchoudhary5185
@khushbuchoudhary5185 3 жыл бұрын
Super video! I applauded for ₹40.00 👏
@myvinbarboza3038
@myvinbarboza3038 4 жыл бұрын
Your the best man 😀
@uka0002
@uka0002 4 жыл бұрын
Great video
@RobinsonGames
@RobinsonGames 4 жыл бұрын
Really good explanation with a good visual display of those
@hippiestafarii
@hippiestafarii 4 жыл бұрын
Thank for sharing :-)
@shaikshasayyad131
@shaikshasayyad131 5 жыл бұрын
Crystal clear explanation!!! thanks a million .. I observed that the code was working fine though i had not used the volatile keyword at 9:37. what could it be the reason ?
@DefogTech
@DefogTech 5 жыл бұрын
It will work 99% of the time, but java memory model doesn't guarantee it will work all the time, thus we need the keyword
@shaikshasayyad131
@shaikshasayyad131 5 жыл бұрын
Thanks a lot for your your response.
@kannadasans7564
@kannadasans7564 4 жыл бұрын
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👍
@aniln4736
@aniln4736 4 жыл бұрын
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
@kamilwrobel4438
@kamilwrobel4438 2 жыл бұрын
So if two threads are runing in one core, there is no need to use volatile keyword because they share same cache?
@philthehuman
@philthehuman 5 жыл бұрын
Very clear video, though I would like suggest you to fix the code examples of locks or at least to have a disclaimer by voice that no one should use locks by your examples and should read a documentation instead which says you have to use "try { .. } finally { lock.unlock(); }" construct.
@DefogTech
@DefogTech 5 жыл бұрын
Agreed. Will add a card to the video. Thanks!
@mahendrakhedhar6054
@mahendrakhedhar6054 5 жыл бұрын
read write barrier means what sir please explain if we use volatile what happens to those barriers
@lzf804
@lzf804 4 жыл бұрын
Thank you!
Java ExecutorService - Part 1 - Introduction
10:12
Defog Tech
Рет қаралды 404 М.
The Java Memory Model - The Basics
23:41
Jakob Jenkov
Рет қаралды 118 М.
WHY IS A CAR MORE EXPENSIVE THAN A GIRL?
00:37
Levsob
Рет қаралды 18 МЛН
Кәріс өшін алды...| Synyptas 3 | 10 серия
24:51
kak budto
Рет қаралды 1,2 МЛН
КАКОЙ ВАШ ЛЮБИМЫЙ ЦВЕТ?😍 #game #shorts
00:17
Poopigirl
Рет қаралды 10 МЛН
Garbage Collection (Mark & Sweep) - Computerphile
16:22
Computerphile
Рет қаралды 233 М.
Multithreading in Java Explained in 10 Minutes
10:01
Coding with John
Рет қаралды 870 М.
Choose the best Garbage Collector in Java
12:33
Defog Tech
Рет қаралды 64 М.
The Java memory model explained, Rafael Winterhalter
48:01
Bulgarian Java User Group
Рет қаралды 15 М.
9. Java Memory Management and Garbage Collection in Depth
48:48
Concept && Coding - by Shrayansh
Рет қаралды 41 М.
Java Concurrency Interview - What is an Ideal Threadpool size?
13:44
14. JAVA. Memory Model | Технострим
30:20
VK Team
Рет қаралды 40 М.
Java ReentrantLock - fairness, tryLock and more
13:17
Defog Tech
Рет қаралды 129 М.
Урок Java 346: Volatile и happens before
18:16
Уроки Java
Рет қаралды 11 М.
Эффект Карбонаро и бумажный телефон
1:01
История одного вокалиста
Рет қаралды 2,8 МЛН
What model of phone do you have?
0:16
Hassyl Joon
Рет қаралды 78 М.
wireless switch without wires part 6
0:49
DailyTech
Рет қаралды 1,5 МЛН
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 5 МЛН