[comp.unix.xenix] Shared Memory Attach Error - ENOMEM?

toppin@melpar.UUCP (Doug Toppin X2075) (03/02/90)

We are running SCO Xenix 2.2.3 on the 286.  I have a problem that
I can't find the cause of.  I have a program that creates 12
shared memory segments with no problem.  Then, 20 or so
applications get run and attach to 1 or 2 of the segments each.
One of the applications attaches to 10 of them.  This app fails
in an shmat with the error ENOMEM if it is run after the other
apps.  I know the segment is already created so additional memory
is not being allocated for the segment unless this is happening
as a result of the attach.  I have NSDSEGS and NSDSLOTS set so
that 60 attaches should be possible (assuming that
NSDSEGS*NSDSLOTS = total number of attaches possible).  I also
have the max number of open files set to over 100 so I don't
believe that it is related to that.  I can duplicate the problem
with a small program that attempts to attach to the same 10
segments after all of my other apps are running so it is not a
bug.  I can run it before any of the others and it works.  I am
guessing that part of the overhead of attaching a process to shm
involves allocating additional memory (rather than just modifying
segment registers).  I do know that when all of the apps are
running that the machine is swapping.  (About 4.5 meg of s/w with
3-meg of memory).

My questions are:
* if memory is fully used can a process attach to shm?
* does memory get allocated when a process attaches to an existing segment?
* what can cause the ENOMEM error in an shmat to an existing segment?

Please post or reply to me if you have helpful suggestions.
Suggestions that are not helpful include:
* get a 386
* get more memory
* have fewer programs
* don't attach so much

thanks
Doug Toppin
uunet!melpar!toppin