I have lots of small files. To save file handles and improve IO efficiency, these files are packed into a big single file. However, for some reason, these small files should be able to update in runtime. So Updating and reading different parts of a big single file at the same time by different threads is required.
Because of the memory limit, mmap is not a good choice. I have to implement it by myself. But I’m concerned about is it safe to read and write different parts of a single file at the same time on iOS/Android. How can I make sure the block which is being writing will not read by other thread.
Should I implement the whole feature by thread locks or there has been some mature technic to do the same work?