Tagged articles
2 articles
Page 1 of 1
Senior Brother's Insights
Senior Brother's Insights
May 24, 2022 · Fundamentals

Why Does Thread A Always Grab the Lock First? A Deep Dive into Java Synchronization, JVM Internals, and CPU Fundamentals

This article explores the evolution from early mechanical calculators to modern CPUs, explains thread states, synchronization mechanisms, memory barriers, volatile semantics, and JVM lock implementations, and reveals why Java's notify method consistently awakens a specific waiting thread.

CASCPU architectureJVM internals
0 likes · 39 min read
Why Does Thread A Always Grab the Lock First? A Deep Dive into Java Synchronization, JVM Internals, and CPU Fundamentals
Youzan Coder
Youzan Coder
Jul 8, 2021 · Backend Development

Deep Dive into Java Thread States and Synchronized Lock Implementation

The article thoroughly explains Java thread states and how the synchronized keyword is implemented, detailing the mapping to OS thread states, the object header’s Mark Word, biased, lightweight and heavyweight locking, CAS‑based state transitions, bytecode monitor instructions, lock upgrades, and optimal usage scenarios.

JVM internalsjavalocking
0 likes · 39 min read
Deep Dive into Java Thread States and Synchronized Lock Implementation