Operating System - HP-UX
1834019 Members
2970 Online
110063 Solutions
New Discussion

Re: User executable in Memory

 
SOLVED
Go to solution
Glynn Aherne_1
Advisor

User executable in Memory


Is it possible to load an executable into shared memory for faster access and to save on resources. This executable will be executed many times by users in a day. The executable should only be loaded once into memory as opposed to the number of times the users run the executable.

I think by setting the sticy bit on the executable might achieved this but not sure

Thanks in advance

G.
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: User executable in Memory

Hi Glynn:

You are correct. From the man (2) pages for 'chmod':

"If an executable file is prepared for sharing, mode bit S_ISVTX prevents the system from abandoning the swap-space image of the
program-text portion of the file when its last user terminates. Then, when the next user of the file executes it, the text need not be read
from the file system but can simply be swapped in, thus saving time."

Regards!

...JRF...
Fragon
Trusted Contributor

Re: User executable in Memory

Hi James, I have a question.
If these programs are accumulated , will the swap area be not enough? How to prevent such case?

Thank in advance!
-Gerald-
Bill Hassell
Honored Contributor

Re: User executable in Memory

Well, only the text portion is kept in memory and to futher save unnecessary space, multiple copies of the program will use the same text area. The text area is slightly smaller than the actual executable program on the disk. The text area is the unchangeable instructions and thus they can easily shared. Note that you won't be saving any resources, you're just eliminating a read from disk to start the program. Also, once a copy is already executing, the program will never be read from the disk again as each additional copy uses the same text area.

I doubt you will be able to measure any performance gains or see any additional swap usage unless the binary programs on the disk are many megabytes in size.


Bill Hassell, sysadmin
Glynn Aherne_1
Advisor

Re: User executable in Memory



Thanking you for your help


G.
Glynn Aherne_1
Advisor

Re: User executable in Memory


hi,

Just another quick question.

If we're using a 10mb executable to connect to a database. This executable will be open for most of the day. 100 users use this executable.

Is that 1000MB of memory used up on the system ?