Questions about semaphores.

ITEM: RTA000078024



1.- AIX uses 2 semaphores, semid 0 and 1.                                       
    What are they for?                                                          
    Must they be present in every AIX system?                                   
    What do they do?                                                            
2.- We have been trying semaphores and seen that if we create one for           
the first time after the boot the semid is always 2.                            
If then we erase that semaphore and create another one ( call semget() )        
the semid happens to be 4097 (or 409x), but if we erase it and create           
another one the semid is 8xxx, and so on.                                       
   Is not the semid supposed to be sequential?                                  
   Why AIX take such high semid's?                                              
   It is important for any user application the semid number?                   
                                                                                
ANSWER                                                                          
Semid 0 is used by the srcmstr.                                                
Semid 1 is used by the sendmail.                                                
In general, Semaphores provide a way for processes to serialize                 
access to critical                                                              
resources.                                                                      
The semid numbers 0,1,... then 4xxx, then 8xxx and so on are normal.            
The semid is generated by a formula which jumps 4K when you remove              
a semaphore.                                                                    
I think the reason for the jump is that it lessens the chances for a            
removed semid to be used again.                                                 
The semid is important for applications. It is used as an identifier            
for semctl(), semop() system calls.                                             
                                                                                
S e a r c h - k e y w o r d s:                                                  
SEMAPHORES SEMID AIX IPCS IPC                                                   
                                                                               


WWQA: ITEM: RTA000078024 ITEM: RTA000078024
Dated: 03/1995 Category: ITSAI6000GE
This HTML file was generated 99/06/24~12:43:27
Comments or suggestions? Contact us