This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum, neologix, vstinner
Date 2014-02-07.15:48:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAP7+vJKinTJOknX2h3RmQ1w9m-zrUTh2RDT9w4xK7o4rX+gqsQ@mail.gmail.com>
In-reply-to <CAH_1eM2ZfAgF1reMXt+BC6gfDC1bzErVpXnF=UriizB18Dw8yQ@mail.gmail.com>
Content
OK, this sounds like rounding up is important to avoid busy-wait (but maybe
only when rounding down would give us zero), and we shouldn't have to worry
about a courser timer, it will just make us late and that's always
acceptable.

On Fri, Feb 7, 2014 at 1:13 AM, Charles-François Natali <
report@bugs.python.org> wrote:

>
> Charles-François Natali added the comment:
>
> > How sure are you? Suppose I use poll() with a 0.5 msec timeout. This
> > presumably gets rounded up to 1 msec. But if the system clock has e.g. a
> 10
> > msec resolution, won't this still wait 0 msec? Or will it wait until the
> > next "tick" occurs, which could be anywhere between 0 and 10 msec in the
> > future?
>
> It depends :-)
> With high-resolution timers, you'll get 1ms.
> Without, you'll likely get 10ms (time quantum).
> An implementation returning without delay would be seriously broken.
>
> > But if so, why wouldn't a poll() with a 0 msec timeout also wait
> > between 0 and 10 msec?
>
> Because the kernel doesn't suspend the current task/thread, it just checks
> the list of currently FDs, and returns immediately.
> See e.g.
>
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/select.c?id=797a796a13df6b84a4791e57306737059b5b2384#n772
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue20505>
> _______________________________________
>
History
Date User Action Args
2014-02-07 15:48:35gvanrossumsetrecipients: + gvanrossum, vstinner, neologix
2014-02-07 15:48:35gvanrossumlinkissue20505 messages
2014-02-07 15:48:35gvanrossumcreate