| that's why I was genuinely asking. You weren't asking, you were saying it wasn't necessary, which you did in the sentence right before this one: Also, you can use normal (non-file-backed) memory to do the necessary synchronization (lock-free or not). Again, this is just a repeated claim, it isn't an explanation. How do you have two processes writing to the same place in memory without memory mapping a file? have two processes read() and write() _directly_ to the same memory I didn't say read() and write() I said read and write as in reading and writing with memory addresses. Again, this is all about lock free interprocess communication. You can't write outside your own memory from a process with normal permissions so how do you share memory with another process? You memory map the same file. This isn't about the file being written to some sort of persistent storage, that happens on the OS level and doesn't interfere with two running processes communicating with each other. The file can be deleted after the last process closes it. It is just a way for the two processes to have memory mapped into their virtual memory space that overlaps with each other. You need to deal with memory directly so you can use atomics. You need to use atomics so you can avoid locks. I thought you might have had some other technique that I'm not aware of but it seems now you were making claims without much behind them, which is disappointing. |
In increasing order of modernity: System V SHM, POSIX SHM, and `mmap(... MAP_SHARED | MAP_ANONYMOUS ...)` (e.g., on Linux).