- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- What is a Semaphore?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2001 02:56 AM
тАО06-21-2001 02:56 AM
I had believed that a semaphore was some type of a polling lock on memory? Although this was probably specific to an application I was looking at a long time ago.
Can anyone explain in bog english! the semaphore?
Thanks,
Bill
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2001 03:11 AM
тАО06-21-2001 03:11 AM
Re: What is a Semaphore?
A semaphore is a flag of a process state and can be related to memory.
A semaphore can store just about anything:-
File process state
User count
Record locks
Universe uses semaphore for :-
? File lock semaphores
? Group/update record lock semaphores
? Login semaphore
? Port status semaphore
? Dynamic file semaphore
? Transaction logging semaphore
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2001 03:42 AM
тАО06-21-2001 03:42 AM
Re: What is a Semaphore?
A chapter on semaphores can be found in the "HP-UX MultiProcessing White Paper":
http://docs.hp.com/hpux/onlinedocs/5965-4643/5965-4643.html
Information on kernel configuration parameters relating to semaphores can be found here:
http://docs.hp.com/hpux/onlinedocs/os/KCparam.SemaParmsOverview.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2001 03:50 AM
тАО06-21-2001 03:50 AM
SolutionA semaphore is a memory data which store a
counter. You can access semaphore by semXXX
functions (in C, semget, semop,...). System
assume that only one processe can access to
this memory space in a same moment.
A semaphore can be share between some processes
to communicate (locks, ...).
Semaphores are parts of IPC (InterProcess
Communication), so you can make some operations
using ipcs and ipcrm commands (see man page
for details).
There are 3 kernel parameters for tuning :
semmns, semmni ,semmap. Refer to documentations
for details, but you need with DB you seems to
need more semaphores (For file and memory
locking) .For share memory (IPC part also you
have shmXXX parameters)
HTH
Herve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-22-2001 12:18 AM
тАО06-22-2001 12:18 AM
Re: What is a Semaphore?
The name Semaphore is taken from that when which allow one train to access unique rail at one specific time ( this prevent from train crash ).
When you have a critical section lets say a printer, when you use a semaphore ( private semaphore ) this allows only one job to be printed at a time when it finishes another single job can be printed.
Other Semaphores can have n number of concurent process simultanously running on the same ressource and each time one finish the first process in the waiting list will take place in manipulating the ressource.
When a process look for a ressource it executes a P function and when it finishes it executes a V function. each V function executed allow a process, which had exeecuted a P and in the waiting list, to manipulate the ressource.
Example: When a user updates an oracle row, the Oracle rdbms prevent any other process from doing other updates on that row till the first process finishes with.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-22-2001 02:05 AM
тАО06-22-2001 02:05 AM
Re: What is a Semaphore?
A semaphore is a counter used to provide access to a shared data object ( or a resource ) for multiple process. To obtain a shared resource aprocess needs to do the following :
1. Test the semaphore that controls the resource.
2. If the value of the semaphore is positive, the process can use the resource. The process decrements the semaphore value by one, indicating that it has used one unit of the resource.
If the value of the semaphore is 0, the process goes to sleep until the semaphore value is greater than 0 ( ie. when a process finish with a resource it MUST increase the value of the semaphore counter by one, and this wake up the schedular to honor the first process in the waiting queue ).
The Unix kernel maintains a semid_ds structure for each semafore :
struct semid_ds {
struct ipc_perm sem_perm ;
struct sem *sem_base; /* pointer to first semafore in set */
ushort sem_nsems; /* Number of semaphores in set */
time_t sem_otime; /* last-semop() time */
time_t sem_ctime; /* last-change time */
};
struct sem {
ushort semval; /* semaphore value */
pid_t sempid; /* pid for last operation */
ushort semncnt; /*number of process awaiting semval > currval */
ushort semzcnt; /* number of process awaiting semval = 0 */
Kernel variables :
SEMVMX : max value of any semaphores.
SEMAEM : max value of any semaphore's adjust-on-exit value.
SEMMNI : max number of semaphore sets.
SEMMNS : max number of semaphores.
SEMMSL : max number of semaphores per semaphore set.
SEMMNU : max number of undo structures.
SEMUME : max number of undo entries per undo structures.
SEMOPN : max number of operations per semop call.
I can give you more if you want !
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2005 07:33 PM
тАО05-16-2005 07:33 PM
Re: What is a Semaphore?
i would like to know how to find the information on windows m/c
how many semaphores are active at a given time .
Like how we have the command ipcs on linux to get the status
how to get it on windows
Regards
Manoj