🦋 Timeouts
Question about timeouts on select(): if anyone has ideas about this, please let me know in comments. Obviously select() is not a real-time operation; if you pass in a 1-second timeout, you cannot assume that you will get to run again in one second, since the operating system is allotting time to all the processes on the machine: in an extremely busy environment, it could be several seconds before you get the processor back. But I'm wondering whether the timeout is 1 second of real time, or 1 second of execution time -- in the very busy environment where your process does not get another time slice for more than a second, would select() continue to wait on the files you passed in until it had waited for a second? Or would it return immediately? (select() as it is used in this post should be read to mean "select() and poll()," since I'm assuming both API's behave the same in this regard. Who knows, maybe they don't! But that seems unlikely to me.)
posted afternoon of Friday, May 9th, 2008 ➳ More posts about Programming ➳ More posts about Programming Projects ➳ More posts about Projects
The timeout is one second of real time, and the process goes into a
kernel wait once it calls select, it's the kernel that is keeping
track of time. Once the process becomes runnable again, the
scheduler still has to actually run it, so when it runs isn't
predictable. The process might be put into a wait anyway, just
before it calls select(). So the wait is one second plus whatever
delays the kernel adds.
posted evening of May 10th, 2008 by Randolph Fritz
Thanks!
posted evening of May 10th, 2008 by Jeremy
|