'Does named shared memory imply IO and impact the performance?

I need to share many memory buffers between two processes. I'm trying to use mmap to archive it. According to the doc, only with the MAP_ANONYMOUS flag, no file descriptor is needed, therefore I wouldn't worry about physical IO taking place.

But anonymous mapping only can be used within single process, I need some names to identify each buffer between processes! Therefor I have to use shm_open to create a file descriptor before calling mmap.

After calling shm_open, a file would appear at /dev/shm, I'm worrying about that some disk IO invoked. I know that is a temporary file system, but I'm confusing where it is stored at last?

Is there another way, we can create Named Shared Memory without a file in Linux?

In addition, I need "lazy-allocation" and "full-zero initialization". I'm interested in whether those still be guaranteed with "Named Shared Memory" or not.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source