Files with memory mapping (according to the specification) are largely dependent on the actual OS implementation, and a number of these unknown aspects are already explained in javadoc. However, I have additional questions and do not know where to turn for answers.
Suppose application A maps a file into memory from position=0 to size=10 .
I would suggest that working with the OS requires a continuous chunk of memory? Or is it implementation dependent?
Now suppose we have application B that maps from position=0 to size=11 . Are the first 10 bytes shared or is this a completely different mapping? This relates to the issue of continuous memory.
If we want to use mapped files for IPC, we need to know how data is reflected in other applications, so if B writes to memory, does A do this?
However, since I read the spec, it depends on the OS. This makes it dangerous to use in general-purpose IPCs, since it correctly reduces portability?
Also, suppose the OS supports it, so B writes to memory, A sees a change in what happens if we do this:
B.write("something"); A.write("stuff"); A.read();
What exactly will A read? Or else:
How are file pointers managed?
How does this work with concurrency, is there an application cross-lock?
java memory-mapped-files
nablex
source share