How is shared memory address range determined

How is shared memory address range determined

Post by Patrick Coghl » Sun, 24 Apr 1994 01:34:41



I notice that under HP-UX, processes that attach a region of shared
memory end up with it at the same virtual address.

How does UNIX manage to do this?  Does it preallocate virtual address
space for (max # of shared regions) regions of size (maximum region size)?
Then, use the key provided by the user to map him into a specific range
of virtual addresses (i.e. all users with the same key map into the same
address range)?

 
 
 

How is shared memory address range determined

Post by Ken Gre » Sun, 24 Apr 1994 22:05:29



> I notice that under HP-UX, processes that attach a region of shared
> memory end up with it at the same virtual address.
> How does UNIX manage to do this?  Does it preallocate virtual address
> space for (max # of shared regions) regions of size (maximum region size)?
> Then, use the key provided by the user to map him into a specific range
> of virtual addresses (i.e. all users with the same key map into the same
> address range)?

No, HP-PA uses a 48bit or 64bit global virtual address map. A process is given
4 one GB quadrant from that, one is used for text, that is shared amgost all
processes running the same program. The second of these quadrants is private
data, the third is for shared libraries and the 4th is for shared memory. Both
quadrants 3 and 4 are shared by all processes on the system. As the to process
that are shareing a peice of shared memory are actualy sharing the same part
of the global address map at this point, they have no choice but to see the
shared memory segment at the same address.

--

Ken Green Computer Consultancy  
        Bodega, Jasmine Cres. Princes Risborough, Bucks. HP27 0AB, U.K.