| Solaris |
|
|
Traditionally, the behavior of the System V IPC facilities (shared memory, message queues, and semaphores) was influenced through a large set of /etc/system tunables. While some of the tunables allowed one to set meaningful administrative limits (e.g. maximum shared memory segment size), many simply exposed implementation details (e.g. the number of undo entries in an undo structure).
There were many serious problems with the traditional implementation:
Additionally, a perpetual complaint was that the default values for these tunables were too small.
In Solaris 10 (build 28), these problems were solved by reworking much of the System V IPC implementation to not require as much administrative hand-holding (removing unnecessary tunables), and by using task-based resource controls to limit users' access to the System V IPC facilities (replacing the remaining tunables). At the same time, the default values for those limits which remained were raised to more reasonable values. Lastly, for compatibility, the legacy tunables are interpreted and used to initialize the default privileged limit for the new resource controls. The new resource controls are:
| Resource control | Similar tunable | Old default | New default | Max value |
| project.max-shm-ids | shminfo_shmmni | 100 | 128 | 1<<24 |
| project.max-msg-ids | msginfo_msgmni | 50 | 128 | 1<<24 |
| project.max-sem-ids | seminfo_semmni | 10 | 128 | 1<<24 |
| project.max-shm-memory | shminfo_shmmax | 0x800000 | 1/4 physical | UINT64_MAX |
| process.max-sem-nsems | seminfo_semmsl | 25 | 512 | SHRT_MAX |
| process.max-sem-ops | seminfo_semopm | 10 | 512 | INT_MAX |
| process.max-msg-qbytes | msginfo_msgmnb | 4096 | 65536 | ULONG_MAX |
| process.max-msg-messages | msginfo_msgtql | 40 | 8192 | UINT_MAX |
The following tunables no longer have any effect (tunables listed in italics were removed by previous efforts):
| semsys:seminfo_semmns | semsys:seminfo_semvmx | semsys:seminfo_semmnu |
| semsys:seminfo_semaem | semsys:seminfo_semume | semsys:seminfo_semusz |
| semsys:seminfo_semmap | shmsys:shminfo_shmseg | shmsys:shminfo_shmmin |
| msgsys:msginfo_msgmap | msgsys:msginfo_msgseg | msgsys:msginfo_msgssz |
| msgsys:msginfo_msgmax |
The end result of all this is that all the problems listed above have been addressed. The specific improvements are:
The following major implementation changes were made (for all the details, see os/ipc.c, os/msg.c, os/shm.c, syscall/sem.c):
Maximum number of shared memory ids allowed a project.
When shmget() is used to allocate a shared memory segment, one id is allocated. If the id allocation doesn't succeed, shmget() fails and errno is set to ENOSPC (previously returned when "the system-imposed limit on the maximum number of allowed shared memory identifiers system-wide would be exceeded"). Upon successful shmctl(, IPC_RMID) the id is deallocated.
Maximum number of semaphore ids allowed a project.
When semget() is used to allocate a semaphore set, one id is allocated. If the id allocation doesn't succeed, semget() fails and errno is set to ENOSPC (previously returned when "the system-imposed limit on the maximum number of allowed semaphores or semaphore identifiers system-wide would be exceeded"). Upon successful semctl(, IPC_RMID) the id is deallocated.
Maximum number of message queue ids allowed a project.
When msgget() is used to allocate a message queue, one id is allocated. If the id allocation doesn't succeed, msgget() fails and errno is set to ENOSPC (previously returned when "the system-imposed limit on the maximum number of allowed message queue identifiers system wide would be exceeded"). Upon successful msgctl(, IPC_RMID) the id is deallocated.
Total amount of shared memory allowed a project.
When shmget() is used to allocate a shared memory segment, the segment's size is allocated against this limit. If the space allocation doesn't succeed, shmget() fails and errno is set to EINVAL (currently returned when "The size argument is less than the system-imposed minimum or greater than the system-imposed maximum."). The size will be deallocated once the last process has detached the segment and the segment has been successfully shmctl(, IPC_RMID)ed.
Maximum number of semaphores allowed per semaphore set.
When semget() is used to allocate a semaphore set, the size of the set is compared with this limit. If the number of semaphores exceeds the limit, semget() fails and errno is set to EINVAL (previously returned when "The nsems argument is ... greater than the system-imposed limit").
Maximum number of semaphore operations allowed per semop call.
When semget() successfully allocates a semaphore set, the minimum enforced value of this limit is used to initialize the "system-imposed maximum" number of operations a semop() call for this set can perform.
Maximum number of bytes of messages on a message queue.
When msgget() successfully allocates a message queue, the minimum enforced value of this limit is used to initialize msg_qbytes (which was previously "set to the system limit").
Maximum number of messages on a message queue.
When msgget() successfully allocates a message queue, the minimum enforced value of this limit is used to initialize a per-queue limit on the number of messages.
Official documentation:
Solaris Tunable Parameters Reference Manual
Solaris 10 What's New (see 3/05)
ARC cases:
PSARC 2002/694 System V IPC resource controls
PSARC 2003/047 process.max-msg-messages resource control
Bugs:
4269168 Can't run ICEM Surf with IPC kernel parameters default values.
4325644 Shared Memory limits should be exported
4381822 System V IPC settings should be dynamic
4678797 Solaris default value of shminfo_shmmax is too small
4715904 System V semaphores still suffer from false sharing
4715918 semaphore operations do not scale when SEM_UNDO is specified
4743342 race between msgget and message queue consumers
4743359 race between semget and semaphore consumers
4780063 ipcs may incorrectly report that a message queue has waiting readers
4788894 ipcs may fail to report waiting message queue writers
4808173 System V message queues don't scale, period
Terms of Use
|
Privacy
|
Trademarks
|
Copyright Policy
|
Site Guidelines
|
Site Map
|
Help
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Use.
© 2012, Oracle Corporation and/or its affiliates.