Operating System - HP-UX
1855149 Members
4228 Online
104109 Solutions
New Discussion

Re: Share_magic, exec_magic, and shmem_magic

 
Jeff Hagstrom
Regular Advisor

Share_magic, exec_magic, and shmem_magic

I am on a 9000 box with 11.00, what are the meanings of those words? and how do I tell which one I am running? or do you run all 3 for different purposes?
2 REPLIES 2
Jeff Schussele
Honored Contributor

Re: Share_magic, exec_magic, and shmem_magic

Hi Jeff,

They're compiler or chatr flags as follows:

-N linker option (EXEC_MAGIC flag) to access private data spaces larger than .75 GB

-M option to chatr (SHMEM_MAGIC flag) to access shared memory larger than 1.75 GB

Magic Numbers

Recorded with each executable program is a magic number that determines how the program should be loaded. There are three possible values for an executable file's magic number:SHARE_MAGIC The program's text (code) can be shared by processes; its data cannot be shared. The first process to run the program loads the entire program into virtual memory. If the program is already loaded by another process, then a process shares the program text with the other process.
DEMAND_MAGIC As with SHARE_MAGIC the program's text is shareable but its data is not. However, the program's text is loaded only as needed -- that is, only as the pages are accessed. This can improve process startup time since the entire program does not need to be loaded; however, it can degrade performance throughout execution.
EXEC_MAGIC Neither the program's text nor data is shareable. In other words, the program is an unshared executable. Usually, it is not desirable to create such unshared executables because they place greater demands on memory resources.
By default, the linker creates executables whose magic number is SHARE_MAGIC. The following shows which linker option to use to specifically set the magic number.

Table 1 Magic Number Linker Options To set the magic number to: Use this option:
SHARE_MAGIC
-n

DEMAND_MAGIC
-q

EXEC_MAGIC
-N

HTH,
Jeff

PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Sridhar Bhaskarla
Honored Contributor

Re: Share_magic, exec_magic, and shmem_magic

Hi,


They are different ways the system can use the
virtual memory space. The 32-bit address space is devided into four quadrants with first three with 1GB size and the lastone into two parts of 0.75 GB and 025 for IO.

With shmem_magic, you can go upto 2.75 G of shared memory(Q2+Q3+.75Q4) with the exception that Q2 is to be used only for shared memory segments while Q3 and Q4 are for general shared purposes.

With Exec_magic will allow you to use Q1 (which is meant for text segment) for DATA also while Q2 is still used for DATA and Q3 and .75Q4 are for shared purposes.

The default configuration Share_magic makes Q1 for Text Q2 for Data, Q3 and .75Q4 for Shared Memory.

So if you don't compile your application with the corresponding options for exec_magic and shmem_magic, you will get share_magic.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try