- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Why would select() block if descriptor i want ...
Operating System - HP-UX
1753287
Members
5609
Online
108792
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
Go to solution
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
тАО02-17-2009 08:20 AM
тАО02-17-2009 08:20 AM
Program is supposed to be simple
monitor for processes. Master process creates supervisors that will execute
tasks. master will communicate with supervisors using pipes. supervisor
will tell master about state of running task, master can tell supervisor misc commands.
Master periodically writes to supervisor's pipe and it have to respond.
I want to use select() in master to wait for responce from supervisor.
What happens is that select() blocks, although supervisor had written
responces to corresponding descripotr. If i just read from it, it has data.
Where can be an error? I don't understand.
Code is attached. Currently i'm running this on linux, but will need it on hpux too.
monitor for processes. Master process creates supervisors that will execute
tasks. master will communicate with supervisors using pipes. supervisor
will tell master about state of running task, master can tell supervisor misc commands.
Master periodically writes to supervisor's pipe and it have to respond.
I want to use select() in master to wait for responce from supervisor.
What happens is that select() blocks, although supervisor had written
responces to corresponding descripotr. If i just read from it, it has data.
Where can be an error? I don't understand.
Code is attached. Currently i'm running this on linux, but will need it on hpux too.
Solved! Go to Solution.
- Tags:
- select
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2009 05:20 PM
тАО02-17-2009 05:20 PM
Solution
You need to go back and re-read the select() manpage and/or other select() documentation:
Your code reads:
ret = select(1, &rfds, NULL, NULL, &tv);
which is all well and good if the only FD in which you are interested is FD 0 - the "nfds" parameter is supposed to be one higher than the number of the highest file descriptor set in readfds, writefds or errorfds. From the HP-UX 11.11 manpage for select():
"The nfds argument specifies the range of file descriptors to be tested. The select() function tests file descriptors in the range of 0 to nfds -1."
You might also want to consider lookint at more than one FD at a time in that loop - from a quick glance, it appears you are iterating one at a time through all the fds which is not going to be terribly efficient, and delays with one supervisor will affect the code's ability to process traffic from the others.
Your code reads:
ret = select(1, &rfds, NULL, NULL, &tv);
which is all well and good if the only FD in which you are interested is FD 0 - the "nfds" parameter is supposed to be one higher than the number of the highest file descriptor set in readfds, writefds or errorfds. From the HP-UX 11.11 manpage for select():
"The nfds argument specifies the range of file descriptors to be tested. The select() function tests file descriptors in the range of 0 to nfds -1."
You might also want to consider lookint at more than one FD at a time in that loop - from a quick glance, it appears you are iterating one at a time through all the fds which is not going to be terribly efficient, and delays with one supervisor will affect the code's ability to process traffic from the others.
there is no rest for the wicked yet the virtuous have no pillows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-17-2009 09:04 PM
тАО02-17-2009 09:04 PM
Re: Why would select() block if descriptor i want is readable?
Thank you! I have to read docs more carefully.
>>it appears you are iterating one at a time through all the fds which is not going to be terribly efficient, and delays with one supervisor will affect the code's ability to process traffic from the others.
I've just started and this is more a stub to test what i want than real application. Thanks anyway.
>>it appears you are iterating one at a time through all the fds which is not going to be terribly efficient, and delays with one supervisor will affect the code's ability to process traffic from the others.
I've just started and this is more a stub to test what i want than real application. Thanks anyway.
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