HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- inc or dec specific values in semaphores
Operating System - HP-UX
1833490
Members
2781
Online
110052
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
Forums
Discussions
Discussions
Discussions
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
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
03-18-2007 12:41 PM
03-18-2007 12:41 PM
inc or dec specific values in semaphores
I am trying to code a printer spool simulation.
Assume printer has a resource of 2048Kb.
I have randomly created consumer threads, consume value between 50Kb and 1024Kb. I need to synchorinize these requests and buffer allocation.
So I need to initiliaze the semaphore value to 2048 at the beginnig. But as long as I know wait and signal functions increment and decrement the semap. value by only one. But for example if the consumer value is 50Kb, I need to decrement it by 50. Do you have any idea how can I achieve this?
Assume printer has a resource of 2048Kb.
I have randomly created consumer threads, consume value between 50Kb and 1024Kb. I need to synchorinize these requests and buffer allocation.
So I need to initiliaze the semaphore value to 2048 at the beginnig. But as long as I know wait and signal functions increment and decrement the semap. value by only one. But for example if the consumer value is 50Kb, I need to decrement it by 50. Do you have any idea how can I achieve this?
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2007 01:18 PM
03-18-2007 01:18 PM
Re: inc or dec specific values in semaphores
a friend of mine suggested that, if the consumer value is 50kb, I should do wait or signal in a loop 0 to 50. But don't sure if this would be ok.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2007 01:48 PM
03-18-2007 01:48 PM
Re: inc or dec specific values in semaphores
>I need to decrement it by 50.
Best to let it increment by 1. Then take that value and either multiply by 50, or use it as an index in an array where you have your real values.
On PA there is no hardware to do this. So you can invent your own with spinlocks. On IPF, you have a set of fixed increments for fetchadd, so you would have to use compare and exchange to an increment of your arbitrary value.
Best to let it increment by 1. Then take that value and either multiply by 50, or use it as an index in an array where you have your real values.
On PA there is no hardware to do this. So you can invent your own with spinlocks. On IPF, you have a set of fixed increments for fetchadd, so you would have to use compare and exchange to an increment of your arbitrary value.
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP