[comp.unix.internals] Shared Memory Trouble

edward@bv8c02.UUCP (Edward Bijlsma) (11/09/90)

Hello Unix fans,


I have some problems with the shared memory facilities on our
UNIX systems.

I have a program that needs 4Mb of addressable user data space.
Also does the program make use of shared memory.

When the program attaches shared memory to its address space, 
the operating system does not always leave enough room for
the program to execute.

To prevent that the operating system picks an address too close to
the data segment we first determine an appropriate address to
attach the memory.

So far so good.

Now when I attach a shared memory segment of 512 Kb to the user
address space there are no problems. But when I attach another 
shared memory segment of 512 Kb to the user address space, the
operating system uses an address that is 4 Mb. away from the
previous attach address.

The result of this large gap between the attach addresses is that I
can only attach 2 or 3 shared memory segments before I have reached
the bottom of the address space.

I have determined that the gap between the attach addresses is the value
of the kernel variable SHM_STEP. Another variable SHM_BUF (512Kb)
determines to my believe the maximum size of a shared memory segment
that can be created by a shm_get() call.
(Unfortunately I do not have hardware manuals)

I would like to change the kernel so that the attach addresses
are only 512 Kb apart hereby making maximum use of the user
address space.

My questions are: 

- Are the statements above true ?
- Can I change SHM_GET to 512 Kb ?
- Are there more parameters that need to be changed in the kernel ?

Any help will be appreciated.


Edward Bijlsma @ Baan Info Systems, The Netherlands
..!hp4nl!baan!edward
edward@baan.nl