Shared memory: how does shmget () / shared memory work?

Looking at the shmget () manual pages, I understand that calling shmget () allocates the number of pages in memory that can be shared between processes.

Are you going to create a kernel memory page that is mapped to handle the local address space? or is it the same process memory page reserved for this segment, and the same will be used for other connected processes?

My guess: When shmget () is called, the kernel reserves # segments / pages. When shmat () is called, the reserved segment is displayed to handle the address space / page. When a new process joins the same segment, the previously created kernel segemnt is mapped to the new address space of the process.

Is it correct?

+6
source share

All Articles