my application requires concurrent access data file using memory mapping. goal make scalable in shared memory system. after studied source code of memory mapped file library implementation, cannot figure out:
- is legal read
mappedbytebufferin multiple threads?getblock otherget@ os (*nix) level? - if thread
putmappedbytebuffer, content visible thread callingget?
thank you.
to clarify point: threads using single instance of mappedbytebuffer, not multiple instances.
buffers not thread safe , access should controlled appropriate synchronisation; see thread safety section in http://docs.oracle.com/javase/6/docs/api/java/nio/buffer.html . bytebuffer subclass of buffer class , therefore has same thread safety issue.
trying make scalable use of memory mapped files in shared memory system looks highly suspicious me. use of memory mapped files performance. when step shared systems, looking performance should 1 thing give low priority at. not should slow system have many other problems make work should first (and only?) priority @ beginning. won't surprised if @ end need replace concurrent access data file using memory mapping else.
for ideas use of exchanger, see can multiple threads see writes on direct mapped bytebuffer in java? , options make java's bytebuffer thread safe .
Comments
Post a Comment