title: How to implement Concurrent read to a file mapped to memory in Java?
body: <p>I have many threads that concurrently read the same file(entirely about 100M), and only one thread to update the file. I want to map the file in memory to reduce FILE I/O. How can this be done in Java?   </p>
  
  <p>I basically have considered the following 2 methods:</p>
  
  <ol>
  <li>with byte array to store the file, and each time create ByteArrayInputStream to read the buffer when multi-thread read.</li>
  <li>with NIO to get one file channel, synchronized the channel to read from the MappedByteBuffer for multi-thread read.</li>
  </ol>
  
  <p>I'm not sure whether the methods should work. Please help to give some hint if there is a better solution.</p>