Memory Mapped File Benefits
- They are a means of IPC (Process intercommunication), which is very fast
- You don't have to use the slow system calls such as
open
,read
,write
(they are terribly slow, because the cpu has to do context switching if you are calling a system call - You can use a very clean interface: writing to the main memory. That is easy and people know how to use it
- No disk-I/O is wasted, all modifications are done in RAM. For one, other processes can utilize the disk better and for another you increase the durability of your SSD, which has a limited amount of overwrites until it is defunct
- Random Access is much faster by any means, since RAM is "Random Access Memory" and was built for exactly that
One drawback however is that you should save your memory-mapping back to disk from time to time. Imagine yourself doing some highly complicated operations in RAM for hours and all of a sudden there's a black out - all information is lost.