Where is shared memory allocated?

On Linux, when we use data between two or more processes using shared memory, where is shared memory allocated?

Will it be part of the process address space at runtime? because the process cannot access memory outside its address space.

Can someone clarify?

+3
source share
2 answers

When you have shared memory, then that memory is mapped into the virtual address space of each process that shares the memory (not necessarily on the same virtual addresses in each process). The virtual memory manager ensures that virtual addresses are mapped to the same physical addresses as the actual sharing.

+4
source

Assuming system V: one process takes up memory that is allocated inside its process space and makes it available to others through IPC. The most common way to share it is to map the memory in the virtual address space of another process. In this case, they can access the memory as if it were part of their address space won.

0
source

Source: https://habr.com/ru/post/1769454/


All Articles