RedHatAS4 kernel-optimized kernel. sem settings

Source: Internet
Author: User
Semaphore is an overview of semaphores (Semaphore). It is sometimes called a traffic signal. It is a facility used in a multi-threaded environment and coordinates various threads, to ensure that they can use public resources correctly and reasonably. Semaphore is divided into two types: single value and multi-value. The former can only be obtained by one thread, and the latter can be obtained by several threads. Take a parking lot as an example. For the sake of simplicity, assuming that there are only three parking spaces in the parking lot, all three parking spaces are empty at the beginning. At this time, if there are five vehicles at the same time, the gatekeeper will allow three of them not

Semaphore Overview

Semaphores
Semaphore (Semaphore) is a facility used in a multi-threaded environment. It coordinates various threads to ensure that they can properly and reasonably use public resources.
Semaphore is divided into two types: single value and multi-value. The former can only be obtained by one thread, and the latter can be obtained by several threads.
Take a parking lot as an example. For the sake of simplicity, assuming that there are only three parking spaces in the parking lot, all three parking spaces are empty at the beginning. At this time, if there are five vehicles at the same time, the gatekeeper will allow three of them to enter without hindrance, and then put down the car, and the remaining cars will have to wait at the entrance, since then, all the cars have to wait at the entrance. At this time, a car left the parking lot. After the gatekeeper learned it, he opened the car and put it in one. If he left the two again, he could put them in two again.
In this parking lot system, a parking space is a public resource. Every car is like a thread. The Gatekeeper plays the role of a semaphore.
Furthermore, semaphores have the following features: semaphores are a non-negative integer (number of parking spaces) and all threads (vehicles) passing through them) all the threads that attempt to pass the integer are in the waiting state when the integer is reduced by one (it is certainly used to use resources. In semaphores, we define two types of operations: Wait (Wait) and Release (Release ). When a thread calls the Wait (Wait) operation, it either reduces the semaphore by one or waits until the semaphore is greater than one or times out. Release (Release) is actually an addition operation on the semaphore, corresponding to the vehicle leaving the parking lot. This operation is called "Release" because the addition operation actually releases the resources protected by the semaphore.

Before installing Oracle, you usually need to set the kernel. sem parameter.
Kernel. sem Configuration

View the kernel. sem size

Sem is the abbreviation of semaphores. view the current settings.
# Cat/proc/sys/kernel/sem

250 32000 100 128

Or

# Sysctl-a | grep kernel. sem
Error: permission denied on key 'kernel. cad_pid'
Kernel. sem = 250 32000 32 128

Or

# 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

Parameter description

The preceding four data parameters correspond to the following core parameters: SEMMSL, SEMMNS, SEMOPM, and SEMMNI.

SEMMSL: used to control the maximum number of signals in each signal set.
Oracle recommends that you set SEMMSL to the setting value of the maximum PROCESS instance parameter in the init. ora file (for all databases in Linux) plus 10. In addition, we recommend that you set the SEMMSL value to at least 100 for Oracle.
SEMMNS: used to control the maximum number of signals (rather than signal sets) in the entire Linux system.
Oracle recommends that you set SEMMNS to the sum of the PROCESSES instance parameter setting values for each database in the system, and double the maximum PROCESSES value. Finally, based on the number of Oracle databases in the system, add 10 to each.
Use the following formula to determine the maximum number of signals that can be allocated in Linux. It will be a smaller value of the following two: SEMMNS or (SEMMSL * SEMMNI)

SEMOPM: kernel parameters are used to control the number of signal operations that can be performed by each semop system call. Semop System Call (function) provides the function of using a semop system call to complete multiple signal operations. A signal set can have the maximum number of SEMMSL signals in each signal set. Therefore, we recommend that you set SEMOPM to SEMMSL.
Oracle recommends setting the SEMOPM value to at least 100.
SEMMNI: The Kernel Parameter is used to control the maximum number of signal sets in the entire Linux system. Oracle recommends setting the SEMMNI value to at least 100.
Change the current SEMAPHORES parameter settings
[Oracle @ ebsse oracle] $ su
Password:
[Root @ ebsse oracle] # echo "5010 641280 5010 128">/proc/sys/kernel/sem
[Root @ ebsse oracle] # cat/proc/sys/kernel/sem
5010 641280 5010 128
To enable automatic application at startup, add the following in/etc/sysctl. conf:
Kernel. sem = 5010 641280 5010 128

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.