简体   繁体   English

Java中mmap的内存模型可见性/同步

[英]mmap'd memory model visibility/synchronization in java

What differences are there (if any) between the regular java memory model for memory in the heap vs an mmap'd file accessed through a direct byte buffer? 用于堆中内存的常规Java内存模型与通过直接字节缓冲区访问的mmap文件之间有什么区别(如果有)?

Eg if I have multiple threads writing to the byte buffer, is there any special synchronization necessary to ensure that a reader thread will see all the changes? 例如,如果我有多个线程写入字节缓冲区,是否有必要进行特殊的同步以确保读取器线程可以看到所有更改?

No difference. 没有不同。 Yes, you have to have store synchronized-with edges between writers and the reader to ensure data is written to the buffer. 是的,您必须在写入器和读取器之间存储与边缘同步的数据,以确保将数据写入缓冲区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM