semaphores主要用于进程之间或者进程内的线程之间的共享资源同步操作,System V的信号机制支持semaphore set,每一个semaphore set就是一个semaphore计数器,当程序请求一个semaphores时,kernel分配给他一个semaphore set
可以用下面指令获得当前semaphore的设置
# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767
1.SEMMNI
SEMMNI定义了max number of arrays的大小,表示系统内的最大semaphore set大小,这个缺省值128差不多了.
2.SEMMSL
SEMMSL定义了max semaphores pre array的大小,表示每个semaphore set的最大semaphore数.oracle进程获得系统的一个semaphore set,oracle进程内的每个线程需要一个semaphore,假如你的系统内只有一个oracle实例,你的SEMMSL的值需要等于或稍大于(oracle中定义的最大PROCESSES数+10),如果是MTS模式,可以适当放小.
3.SEMMNS
SEMMNS定义了max semaphores system wide的大小,表示系统内允许的最大semaphore set大小,系统缺省大小为(SEMMNI*SEMMSL),oracle推荐的设置为系统内所有数据库的PROCESSES参数的总和,加上最大的的那个PROCESSES,然后加上10.
4.SEMOPM
SEMOPM定义了每个semop系统调用能够操作的最大semaphore数,semop系统调用主要是一个semaphore set的semaphore操作,这个值系统缺省为32,建议设置等于SEMMSL.
调整semaphores设置
#echo "250 32000 100 128" > /proc/sys/kernel/sem
并在sysctl.conf中加入
kernel.sem=250 32000 100 128
Apache: No space left on device: Couldn't create accept lock
处理方法:
http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/
Semaphores? What the heck is a semaphore? Well, it's actually an apparatus for conveying information by means of visual signals. But, when it comes to programming, semaphores are used for communicating between the active processes of a certain application. In the case of Apache, they're used to communicate between the parent and child processes. If Apache can't write these things down, then it can't communicate properly with all of the processes it starts.
I'd assume if you're reading this article, Apache has stopped running. Run this command as root:
# ipcs -s
If you see a list of semaphores, Apache has not cleaned up after itself, and some semaphores are stuck. Clear them out with this command:
# for i in `ipcs -s | awk '/httpd/ {print $2}'`; do (ipcrm -s $i); done
Now, in almost all cases, Apache should start properly. If it doesn't, you may just be completely out of available semaphores. You may want to increase your available semaphores, and you'll need to tickle your kernel to do so. Add this to /etc/sysctl.conf:
kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024
And then run sysctl -p to pick up the new changes.
阅读(2745) | 评论(0) | 转发(1) |