Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where does the shared memory gets allocated?

Tags:

unix

In Linux, When we are sharing data between 2 or more processes using shared memory, where does the shared memory gets allocated?

Will it become part of process address space at run time? as the process cannot access the memory outside its address space.

Could some one please clarify?

like image 316
Teja Avatar asked Oct 29 '25 20:10

Teja


1 Answers

When you have shared memory, then that memory gets mapped into the virtual address space of each process that shares the memory (not necessarily at the same virtual addresses in each process). The virtual memory manager ensures that the virtual addresses both map to the same physical addresses so that the sharing actually happens.

like image 137
Adam Rosenfield Avatar answered Oct 31 '25 11:10

Adam Rosenfield