How to increase semaphore value in linux?

What is semaphore ?

Semaphore can be described as counters used to control access to shared resources by multiple processes, They are most often used as a locking mechanism to prevent processes from accessing a particular resource while another process is performing operations on it.

Semaphore can be used when number of processes try to access the shared resource or same file,Semaphore stored in kernel, so that it can be accessed by all the processes,

  •  Semaphore can be identified unique id in linux kernel and it can be deleted using semdelete function,
  • semaphore values can be incremented or decremented by using functions wait and signal,   
  • If we are using ONFS (Oracle over network file system) in linux, we need to increase the kernel.sem value to improve system performance

How to Increase semaphore value in linux?

To increase semaphore value we need to increase the value of kernel.sem.

[root@server ~]# sysctl -A | grep kernel.sem
kernel.sem = 250        32000   32      128

[root@server ~]# 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

Increase semop value from 32 to 100, it can be increased upto 250 which is equal to semaphores per array,

Add the following line into /etc/sysctl.conf file,

#vi /etc/sysctl.conf

kernel.sem = 250 32000 100 128


#sysctl -w "kernel.sem = 250 32000 100 128"


#sysctl -w "kernel.sem=4096 512000 1600 2048" 

kernel.sem: max_sem_per_id max_sem_total max_ops_sem_call max_sem_ids

Now we have modified the kernel.sem value,

Please run the following command to update the changes 

[root@server ~]# sysctl -p

Now semaphore value got changed on can verify using ipcs command.

How to get UUID value and disk device attributes in Linux ?

How to view UUID values and print block device attributes in linux?

Option 1 : Using blkid command

Option 2 : Using dumbe2fs command
Option 3: using  #ls -l /dev/disk/by-uuid

To view UUID values and block device attributes:

[root@serverA ~]# blkid

/dev/cciss/c0d0p1: LABEL="/boot" UUID="0e811819-43e9-44dc-b63d-2fb8f74a9793" SEC_TYPE="ext3" TYPE="ext2"
/dev/dm-0: UUID="1607f7e2-330f-49cc-bbbb-56dbc7153bd9" SEC_TYPE="ext3" TYPE="ext2"
/dev/dm-1: UUID="605c8097-e59f-4f42-a63f-4668d457a9b2" SEC_TYPE="ext3" TYPE="ext2"
/dev/dm-2: UUID="9c6abcac-dbc8-4512-a36f-98fad866032d" SEC_TYPE="ext3" TYPE="ext2"
/dev/dm-3: UUID="ff42077e-1b86-423b-948c-c69b98b404da" SEC_TYPE="ext3" TYPE="ext2"
/dev/dm-4: UUID="51ed13d1-e0ea-430b-8dc4-a30ffdd3ca22" SEC_TYPE="ext3" TYPE="ext2"
/dev/dm-5: TYPE="swap" UUID="32e63d41-d037-49c0-9864-654d968e4436"
/dev/dm-6: UUID="4014b540-6809-4d72-aa30-588031e5c37c" TYPE="swap"
/dev/dm-7: UUID="de51f7a8-7dca-4551-b02b-8f6123349085" SEC_TYPE="ext3" TYPE="ext2"

Gather information about I/O limits:

[root@serverA ~]# blkid -i /dev/sda1


Option2: dumpe2fs command

[root@serverA ~]# dumpe2fs  /dev/sda3 | grep UUID

dumpe2fs 1.41.12 (17-May-2010)
Filesystem UUID:          7b84a8a0-08cb-48f0-9d80-a0d2a52990d9


Option 3 : ls -l /dev/disk/by-uuid/

[root@serverA ~]# ls -l /dev/disk/by-uuid/

total 0
lrwxrwxrwx 1 root root 10 Jul 18 19:42 54BC9BC5BC9B9FD2 -> ../../sda1
lrwxrwxrwx 1 root root 10 Jul 18 19:41 7b84a8a0-08cb-48f0-9d80-a0d2a52990d9 -> ../../sda3
lrwxrwxrwx 1 root root 10 Jul 18 19:41 a5808574-4c35-4f13-86ae-706668ac3e3b -> ../../dm-1
lrwxrwxrwx 1 root root 10 Jul 18 19:42 E0987DB6987D8BB2 -> ../../sda5
lrwxrwxrwx 1 root root 10 Jul 18 19:41 f29e8378-5850-47ad-b02f-803e928abff4 -> ../../dm-0

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks