- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- atomic operations
Operating System - HP-UX
1760558
Members
2831
Online
108894
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
тАО05-30-2001 10:59 PM
тАО05-30-2001 10:59 PM
atomic operations
I need to implement few atomic operation (add, inc, compare and swap, swap)using HPUX 11 (9000). Currently I'm using "#pragme _CNX critical_section". Is there another way? Although is seems to be working between threads in the same process, I'm not sure this way is safe when doing operation on objects in shared memory from several different processes.
Thanks, Eyal.
Thanks, Eyal.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2001 12:38 AM
тАО05-31-2001 12:38 AM
Re: atomic operations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2001 07:01 AM
тАО05-31-2001 07:01 AM
Re: atomic operations
Hi Eyal,
No, the CNX #pragma won't do this for you. It does work for what it intended to do - threads within a single process.
I'll point you to two approaches:
1) If all you are doing is integer flag values,
then use semaphores, semop() was made for
this and is atomic. Man semop, semget, and semctl for details. Use ftok() to create a mutually agreed upon and reproducible key. Man ftok for those details.
2) If you are needing to do more complex operations than on operands other than simple integers, then you still use the semaphores as a lock mechanism, do your shared memory stuff, and unlock the semaphore.
This convention will work for threads and processes.
After looking over the man pages, if you are still confused, I can probably give you some simple examples.
Regards, Clay
No, the CNX #pragma won't do this for you. It does work for what it intended to do - threads within a single process.
I'll point you to two approaches:
1) If all you are doing is integer flag values,
then use semaphores, semop() was made for
this and is atomic. Man semop, semget, and semctl for details. Use ftok() to create a mutually agreed upon and reproducible key. Man ftok for those details.
2) If you are needing to do more complex operations than on operands other than simple integers, then you still use the semaphores as a lock mechanism, do your shared memory stuff, and unlock the semaphore.
This convention will work for threads and processes.
After looking over the man pages, if you are still confused, I can probably give you some simple examples.
Regards, Clay
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP