[comp.unix.aix] Shared Memory for Executable

mroz@eplrx7.uucp (Peter Mroz) (10/10/90)

We are using a program that takes up about 5MB of memory, and were wondering
about the possibility of putting it into a shared memory space.  That way,
if 20 users were running the program, we would only be chewing up 5MB of
memory, not 100MB.

Is this something that is easy to do?  I've been pointed to the shmat 
subroutine, but I would appreciate any tips from the pros.

Thanks,
Peter Mroz

-- 
    Peter Mroz                    |    E.I. Du Pont de Nemours & Co.
    eplrx7!mroz@uunet.uu.net      |    Consultant, Scicon
    mrozpa%wmvx@dupont.com        |    DuPont Building, D4078
                                  |    Wilmington, DE 19898
--
The UUCP Mailer

bengsig@oracle.nl (Bjorn Engsig) (10/10/90)

Article <1990Oct9.183417.7529@eplrx7.uucp> by mroz@eplrx7.uucp (Peter Mroz) says:
|We are using a program that takes up about 5MB of memory, and were wondering
|about the possibility of putting it into a shared memory space.
If the memory you want to share is code, this is done for you by default.

If you want to share data, it's a bit more tricky.

- You can use the shmat, shmget, etc. calls, but it will require you
  to restructure your code, and you have to load your data into your shm
  yourself.

- String literals (at least in C programs) are by default put into shared memory
  together with code.

- Declaring vraibles as const doesn't do it.
-- 
Bjorn Engsig,	       E-mail: bengsig@oracle.com, bengsig@oracle.nl
ORACLE Corporation   From IBM: auschs!ibmaus!cs.utexas.edu!uunet!oracle!bengsig

	"Stepping in others footsteps, doesn't bring you ahead"

neal@mnopltd.UUCP (10/10/90)

->We are using a program that takes up about 5MB of memory, and were wondering
->about the possibility of putting it into a shared memory space.  That way,
->if 20 users were running the program, we would only be chewing up 5MB of
->memory, not 100MB.
->
->Is this something that is easy to do?  I've been pointed to the shmat 
->subroutine, but I would appreciate any tips from the pros.

Isn't AIX  supposed to be SYS V?  Aren't all SYS V executables inherently
sharable right out of the box?   (as far as code space is concerned)

Now, if you had TWO or more programs which between them used the same set of
functions, you might want to consider using the shared libraries facility
to allow common functions to be shared.

------------------------------------------------------------------------------
Neal Rhodes                       MNOP Ltd                     (404)- 972-5430
President                Lilburn (atlanta) GA 30247             Fax:  978-4741
                             emory!mnopltd!neal 
------------------------------------------------------------------------------