0

I'm trying to understand the Memory Model chapter from the Java Language Specification, but I'm already confused by the first two paragraphs:

A memory model describes, given a program and an execution trace of that program, whether the execution trace is a legal execution of the program. The Java programming language memory model works by examining each read in an execution trace and checking that the write observed by that read is valid according to certain rules.

The memory model describes possible behaviors of a program. An implementation is free to produce any code it likes, as long as all resulting executions of a program produce a result that can be predicted by the memory model.

Suppose I implement a Noop JVM that produces an empty execution for any program. When the memory model analyzes the executions by "examining each read in an execution trace," it should obviously conclude that the executions are all valid. If there are no reads, then trivially all reads are valid according to any rules, including those "certain rules" mentioned in the specification.

Does this mean that my Noop JVM is a perfectly valid implementation according to the Java Memory Model, or am I missing something?

2
  • 3
    Well. It won't be valid JVM implementation so there is no reason to think about JMM compliance. Commented Dec 17, 2024 at 14:06
  • 4
    It would be a technically valid (but useless) implementation of the JMM. But not of Java. Commented Dec 17, 2024 at 14:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.