Any concept of shared memory in Java

后端 未结 10 526
猫巷女王i
猫巷女王i 2020-11-29 05:33

AFAIK, memory in Java is based on heap from which the memory is allotted to objects dynamically and there is no concept of shared memory.

If there is no concept of s

10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 05:45

    The information provided by Cowan is correct. However, even shared memory won't always appear to be identical in multiple threads (and/or processes) at the same time. The key underlying reason is the Java memory model (which is built on the hardware memory model). See Can multiple threads see writes on a direct mapped ByteBuffer in Java? for a quite useful discussion of the subject.

提交回复
热议问题