From:Steve Adams
Date:24-May-2001 16:16
Subject:   Shared memory and semaphores

I understand that there are some good internal notes on these topics that you probably have access to. Nevertheless, my opinion is that the setting of SHMMAX is almost a matter of indifference nowadays. In my book (pages 90-91) I explain how the major SGA memory areas can be allocated as non-contiguous subareas if necessary from Oracle8 onwards, making SHMMAX no longer a constraint. The discussion concludes as follows:

"It is commonly suggested that the operating system limit on the size of a single shared memory segment should be raised in order to allow Oracle to allocate the SGA in a single shared memory segment if possible. I follow this advice, but for reasons of manageability. The performance difference is negligible at instance and process startup and is nil otherwise."

The semaphore parameters are also explained in my book (pages 7-10). The following table summarizes the discussion:

ParameterDescription
SEMMNSThe number of semaphores in the system. In addition to the requirements of the operating system and other software, you should allow at least one semaphore for each Oracle server process – that is, the sum of the setting of the processes parameter for all instances on the system. If the semaphore clients are not always shut down and started up in strict sequence, then an extra allowance at least equal to the largest single requirement is recommended.

Further, the kernel parameter controlling the maximum number of simultaneous processes owned by a single named user (often MAXUP) should be at least equal to the SEMMNS setting, with an allowance for other administrative processes owned by the oracle user that do not require semaphores. However, this parameter should not be so large as to allow the risk of another user creating so many processes that the kernel process table would be completely filled. Therefore, the kernel parameter controlling the maximum number of simultaneous processes for all users (often NPROC) should be at least three times the value of SEMMNS.

SEMMSLThe size limit for a single semaphore set. This parameter is not defined on some operating systems. Where it is defined, and where Oracle requires all the semaphores for an instance to be allocated in a single semaphore set, this parameter must be at least equal to the largest processes parameter required for any instance.
SEMMNIThe number of semaphore set identifiers in the system. In addition to the requirements of the operating system and other software, you should allow one identifier per instance, or more if the SEMMSL parameter is set such that multiple semaphore sets will be required for any instance.
SEMMNUThe number of semaphore undo structures in the system. Undo structures are used to recover the kernel semaphore data structures in the event of the unexpected death of a process during a semaphore operation. SEMMNU should be greater than the peak number of running and runnable processes.

Please brief me about the concepts of shared memory and semaphores. How is the SGA related to the SHMMAX parameter? On what basis will I decide the value of SHMMAX and the other related parameters like SEMMNS, SEMMNI, SHMMNI etc? Also give me some information about these kernel parameters.

In some books it is mentioned to set the SHMMAX value to half of the memory size, but in the installation manual it is set to be 4GB even if my RAM is 1GB. I am not really getting any head and tail of how to set this value and on what basis I should set this?