The Java Memory Model - The Basics

preview_player
Показать описание
The Java Memory Model specifies where variables and objects are stored inside the Java virtual machine, as well as how Java Threads access and share these variables and objects. This Java Memory Model tutorial explains the basics of the Java memory model.

Two concepts are left out of this tutorial: The Java synchronized and volatile keywords. Each of these keywords are explained in their own tutorials (see links below).

Chapters
0:00 Introduction to Java memory organzation - AKA the Java Memory Model
0:29 Java Thread stacks and the heap
1:10 Location of local variables and objects
2:52 Code examples of local variable and object locations
10:45 The thread stacks and heap mapped onto a hardware architecture
12:13 How variables and objects move through the RAM, caches and CPU registers
13:19 How the memory organization in Java can lead to race conditions
15:15 Data update visibility between threads
16:35 Cache coherence strategies do not guarantee data update visibility
18:19 Demo of race conditions in Java threads.

Java Memory Model - JSR 133

Java Memory Model tutorial - text:

Java Concurrency playlist:

Java synchronized keyword tutorial:

Java volatile keyword tutorial:
Рекомендации по теме
Комментарии
Автор

Man, in the beginning of the playlist I thought it would be some generic tutorial about threads. But I was so wrong. This here is just pure GOLD. Thanks, Jakob.

kamranvlizad
Автор

I am never see such detailed explanation about threads as this. Thank you Jakob. Pls never remove this videos. We would need it until lifetime)

fuadgafarov
Автор

This playlist is super helpful, I rare to find who explains practical parts linked to theoretical parts without too much abstraction or too much detail, it is just the optimum explanation

MohammadGesrha
Автор

Oh man.... your explanation is so good. I'm preparing for my java interviews and you have covered a lot of stuff in your playlist. Thank you for helping the community. 😬

prakritidevverma
Автор

Most any software engineer has watched, for myriad topics, hundreds of instructional videos. I must say that you are in the top tier of informational content producers.

Your pairing of diagrams with code, and references to both throughout, is excellent. You do a masterful job of relaying complicated concepts to viewers with efficiency. Hats off to you!

matthewsaucedo
Автор

you deserve more subs. your vids are awesome.

jayasribhattacharya
Автор

One of the best tutorials out there.. This is literally a goldmine.. Thanks a lot

Shivam-wksq
Автор

It's so admirable and appreciable that you don't prefer to show ads in your videos. Your videos are concentrated and distraction free. Big thanks Mr. Jakob.

isahilliogluu
Автор

Your videos on multithreading are the best explanation I have come across in 20 years of java exp.

bharatjain
Автор

Great Job Jakob, I have been architecting and developing for over 30 years and I can tell you that you really cover the permutations of what can happen and explain each use case and your use case granularity is noted how you depict how memory is shared or not based on instance or static or shared instance passed into the thread. Your methodology makes sure people have the info to get it. you don't talk bits and pieces you do a comprehensive covering and I hope people understand and appreciate your level of definition and 360 degrees of dimension which produces "understanding"

michaeldemarco
Автор

Jakob Jenkov the level of care and detail you put into your content - videos and written tutorials alike - is absolutely mind blowing and inspiring. Nuff Respect.

snoz
Автор

Thanks done
18:30 example on when threads will be sharing a variable vs each having its own variable. Think of the Runnable like any other object, if the same one is passed to different threads then variables declared inside that runnable will be accessed by the threads. If a new runnable or new object is created for each thread then they will be accessing completely different objects

mostinho
Автор

This is the best explanation for threads on the internet and even in the libraries of the entire world!

rohitk
Автор

Your tutorials are absolutely fantastic and have taught me so much, thank you.

mondofps
Автор

You explain so well. I have been your follower since college, and now I am a software engineer. Great work, really appreciate 😊

aayushmanmishra
Автор

this tutorial and how you slowly present your ideas with examples is too underrated!
You need more subs, views and exposure in general!

reynaldolibutan
Автор

I'm preparing for the OCA exam, and this was exactly what I needed.
I thank you Jakob from the bottom of my heart.

RC_
Автор

thanks you Jakob, I hadnt see tutorials like yours ever. your tutorials are simple and easy to understood, i like it.

hongzhanglin
Автор

God of Concurency..i have bene flowing you since my 2014 when you used to write blog post only...by going through your post i attend interview like a LION when they ask mutithreading a Lot form 10+ yrs exp guy from BLR, India.

shubhamagarwal
Автор

Great explanation. Finally, I understand how local variables work with threads and why it is important to keep this in mind trying to solve race conditions in Java concurrency.
Greetings from Mexico!

samuel