Multithreading Complete Tutorial - Synchronizing the Threads with synchronized

Опубликовано: 16 Октябрь 2024
на канале: Java Puzzle
69
2

This is the part of multithreading series and try to cover all concepts of multithreading from basic to advanced level. In this video we will the discuss about Synchronizing the Threads with synchronized keyword.

Summary of this video:

In JVM, the order of the threads is not guaranteed. It all depends on JVM’s Thread Scheduler.
When there are two or more threads accessing the shared data, it may lead to inconsistent results because of the fact that these threads race on each other to execute a particular block of code. This leads to a race condition.
There are two ways we can instruct JVM to execute a particular block of code without interference: synchronized and ReentrantLock
synchronized can be used with methods and code blocks. It provides more flexibility with the block of code as we can deal with it at a finer granular level.

TIMESTAMPS
0:00 Intro
9:21 Summary

ABOUT OUR CHANNEL
Our channel is about Java Programming. We cover lots of cool stuff such as
Spring Security Basic Authentication Role Based Example:    • Spring Security Basic Authentication ...  
Spring Boot Rest Validation Example :    • Spring Boot Rest Validation Example w...  
Custom Annotation Validation using JPA Spring Boot example :    • Custom Annotation Validation using JP...  

MULTITHREADING COMPLETE TUTORIAL
   • Multithreading Complete Tutorial - Li...  

Check out our channel here:
   / @javapuzzle  
Don’t forget to subscribe!

CHECK OUT OUR OTHER VIDEOS

Generic PatchMapping, Sorting and Pagination Spring Boot Example:    • Generic PatchMapping,  Sorting and Pa...  
Learn generics in 30 minutes:    • Generics in Java | Java Generics Tuto...  
5 Java Classes No one know about:    • 5 Java Classes No one know about | Ja...