Urgent.News

What's breaking now, across thousands of outlets.

Tech

Java 25 Memory Model: The Concurrency Rules Every Java Engineer Thinks They Know - Until Production Proves Otherwise

The Java Memory Model is not a diagram of the heap and stack. It is the contract that decides what one thread is legally allowed to observe from another thread despite CPU caches, compiler optimisation, instruction reordering and concurrent execution. This visual follows the complete reasoning path: 1 Java Code + Threads Your source code has program order, but the compiler, JIT and CPU can…

The Java Memory Model (JMM) is not merely a visual representation of the heap and stack. Instead, it serves as the contract governing what one thread is permitted to perceive from another thread, regardless of the influence of CPU caches, compiler optimizations, instruction reordering, and concurrent execution. This diagram illustrates the step-by-step reasoning process:

1. Java code executed together with threads. The source code maintains program order, however, the compiler, Just-In-Time (JIT) compiler, and CPU can internally reorder operations, provided observable behavior remains legal.

2. Each thread maintains its own execution state, including its Program Counter (PC) register, Java Virtual Machine (JVM) stack, stack frames, local variables, and operand stack.

3. Objects and arrays can be shared between threads, but ensuring a safe visibility of mutations poses a more challenging problem.

4. The JMM establishes the legal relationship between reads and writes in terms of program order, synchronization order, visibility, atomicity, and the crucial concept of happens-before.

5. If shared mutable state is managed by thread-confined means such as immutability, each thread's isolated access, or the use of synchronization primitives like synchronized, volatile, locks, atomic operations, Thread.start() / join(), or higher-level concurrency utilities, then reasoning about concurrency becomes straightforward.

6. When synchronization is correctly implemented, it guarantees predictable visibility and ordering. However, a data race, which arises from incorrect synchronization, can lead to stale values being observed, unexpected ordering, and executions that appear impossible based solely on the source code order.

The essential mental model to grasp is that the Java Garbage Collector (GC) answers the question: "Can this memory be reclaimed?" while the JMM concerns itself with: "Can this thread legally observe that write?" These are fundamentally distinct inquiries.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Hyper3D Hand Stand Review 2026: A Watertight Mesh Isn't a Fit Test

Independent review: both products were tested on my own accounts — free where offered and paid where not — with no vendor-provided access.

  • SupaVoxel mesh has more triangles (952,876) than Hyper3D (120,000)
  • Hyper3D mesh is cleaner and passes static solid check
  • SupaVoxel has more non-manifold edges (213) and face-connected regions (143)

Flaky is a claim only declared inputs can back

Flaky-test detection is one of the features that usually lives behind a cloud login. Nx sells it. It is also one of the easiest things to get wrong, because "flaky" is used to mean "failed and I do…

  • Flaky tests are defined by cache key failure or retry requirement
  • Only tasks with cache blocks are considered for flaky testing
  • Flaky tasks show dim note next to their name in cache.db file

How to find AliExpress best sellers for a keyword, with sold counts and ratings

Disclosure: I build the Actor used in this tutorial. The article was written by an AI assistant from the saved results of my own runs, and every number in it was checked against those results.

  • Create an Apify account for free access
  • Set input parameters: keyword, maxItems, sort by orders
  • Execute search via Apify interface or Python script

The sim writes the story — an unedited 11-minute session of a milsim RTT

Last week the first Open Ground video went up — 2 minutes of a village assault, cut tight. This week is the opposite: 11 minutes, unedited, menus and all .

  • 11-minute session features unedited, menus and all
  • Convoy escort sinks tank in mud, vehicles get stuck
  • On-screen event log narrates simulation's decisions

More from Friday 9 October →