Synchronization & Lock in Java Threads

Photo by Everton Vila on Unsplash

Threads share memory and resources (data, code etc.) Threads execute concurrently. Hence, threads can access common resources simultaneously. This may bring us some undesirable outcome.

Synchronization prevents threads from accessing common resources simultaneously. It allows a thread to access a resource at a time.




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How can I use Python Dictionary?

Temperature Monitoring using Python

The 4 P’s of Success

Apache ShardingSphere — Proofread Oracle DML SQL Definitions —  GSoC 2021

Slow Hosting Make You Lose Customers | Get Lightning Fast Web Hosting

Open Nouse — December 2019 Edition

Integration of AWS in Ubisoft

Why I decided to make and market an iPhone app as a high school student

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thanoshan MV

Thanoshan MV

More from Medium

Fundamentals of Java

[Coding Journal] Java — Method Overloading

Difference between throw & throws in Java?

Builder design pattern — java