- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- what is significance of semaphores to applications
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
Forums
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
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
тАО09-11-2005 06:35 AM
тАО09-11-2005 06:35 AM
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 06:55 AM
тАО09-11-2005 06:55 AM
SolutionSo this makes it a handy dandy tool for applications that need to these kinds of controls. And what app doesn't want these kind of controls.
Rgrds,
Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 07:05 AM
тАО09-11-2005 07:05 AM
Re: what is significance of semaphores to applications
Remember file locking? Well, semaphores can be thought of as really generic advisory locking mechanisms. You can use them to control access to files, shared memory, and, well, just about anything you want. The basic functionality of a semaphore is that you can either set it, check it, or wait until it clears then set it ("test-n-set"). No matter how complex the stuff that follows gets, remember those three operations.
A semaphore is a protected variable (or abstract data type) and constitutes the classic method for restricting access to shared resources (e.g. storage) in a multiprogramming environment.
A Semaphore is a data structure that is useful for solving a variety of synchronization problems.
check put:
# man ipcrm
# man ipcs
# man semctl
To remove/cleanup the semaphore identifier semid from the system
# ipcrm -s simid
[ simid can be found from ipcs command , with grepping the process or username using the semaphore for the application .]
hope this will help:
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 07:37 AM
тАО09-11-2005 07:37 AM
Re: what is significance of semaphores to applications
The word "semaphore" derives from the Greek word for "flag" or "signal". As such, it is a variable used to control access to some common resource: a file; a piece of shared memory, etc.
A semaphore holds a zero or positive count that denotes the number of a resource that is available. One speaks of "P" and "V" operations to "dePlete" and "reVive" the count. Semaphores implement "locks" to resources.
A "P" operation decrecemnts a resource count. IF the count is zero, the process attempting to do the operation is suspended (waits). A "V" operation increcemnts the semaphore count, allowing another waiting process to resume execution. A binary semaphore (i.e one with states (counts) of only 0 and 1) implements a simple "lock" to a resource.
Semaphores form the basis for any multi-threading environement. WIthout them, it would be a city without traffic lights!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 08:02 AM
тАО09-11-2005 08:02 AM
Re: what is significance of semaphores to applications
Here is a document for semaphore , with good depth and many internals..,
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 08:05 AM
тАО09-11-2005 08:05 AM
Re: what is significance of semaphores to applications
Mechanisms like semaphores illustrate the reason I think all UNIX admins should have at least some C/C++ experience. It's difficult to use and understand these facilities unless you do and difficult to troubleshoot problems related to them. You can also play with semaphores using Perl using the IPC::Semaphore module.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 12:39 PM
тАО09-11-2005 12:39 PM
Re: what is significance of semaphores to applications
Semaphores provide an efficient form of interprocess communication. Cooperating processes can use semaphores to synchronize access to resources, most commonly, shared memory. Semaphores can also protect the following resources available to multiple processes from uncontrolled access:
Global variables, such as file variables, pointers, counters, and data structures.
Protecting these variables prevents simultaneous access by more than one process, such as reading information as it is being written by another process. Hardware resources, such as disk and tape drives. Hardware resources require controlled access because simultaneous access can result in corrupted data.
There are named and unnamed semaphores. Named semaphores provide access to a resource between multiple processes. Unnamed semaphores provide multiple accesses to a resource within a single process or between related processes. Some semaphore functions are specifically designed to perform operations on named or unnamed semaphores.
The semaphore lock operation checks to see if the resource is available or is locked by another process. If the semaphore's value is a positive number, the lock is made, the semaphore value is decremented, and the process continues execution. If the semaphore's value is zero or a negative number, the process requesting the lock waits (is blocked) until another process unlocks the resource. Several processes may be blocked waiting for a resource to become available.
The semaphore unlock operation increments the semaphore value to indicate that the resource is not locked.
Refer to the link for more info on ├в Developing and deploying applications on the HP-UX operating system. managing processes, parallel programming, using semaphores├в
Semaphores provide an efficient form of interprocess communication. Cooperating processes can use semaphores to synchronize access to resources, most commonly, shared memory. Semaphores can also protect the following resources available to multiple processes from uncontrolled access:
Global variables, such as file variables, pointers, counters, and data structures.
Protecting these variables prevents simultaneous access by more than one process, such as reading information as it is being written by another process. Hardware resources, such as disk and tape drives. Hardware resources require controlled access because simultaneous access can result in corrupted data.
There are named and unnamed semaphores. Named semaphores provide access to a resource between multiple processes. Unnamed semaphores provide multiple accesses to a resource within a single process or between related processes. Some semaphore functions are specifically designed to perform operations on named or unnamed semaphores.
The semaphore lock operation checks to see if the resource is available or is locked by another process. If the semaphore's value is a positive number, the lock is made, the semaphore value is decremented, and the process continues execution. If the semaphore's value is zero or a negative number, the process requesting the lock waits (is blocked) until another process unlocks the resource. Several processes may be blocked waiting for a resource to become available.
The semaphore unlock operation increments the semaphore value to indicate that the resource is not locked.
Refer to the link for more info on "Developing and deploying applications on the HP-UX operating system. managing processes, parallel programming, using semaphores"
http://h21007.www2.hp.com/partner/technologies/1,2610,,00.html
IA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 08:30 PM
тАО09-11-2005 08:30 PM
Re: what is significance of semaphores to applications
Following link may be of help
http://www.cim.mcgill.ca/~franco/OpSys-304-427/lecture-notes/node31.html
Regards
Mahesh