[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: nanosleep() for shorted than schedule slice
On Sun, Jul 02, 2017 at 05:04:56PM -0700, John Nemeth wrote:
> } > > I wonder if it would make sense for nanosleep(2) to check
> } > > that requested sleeping time is shorter than a schedule
> } > > slice, and if it is, spin the CPU instead of scheduling
> } > > another process. Any opinion on this?
> } >
> } > No, that's wrong. It's also been discussed before.
> } How is that wrong? It was always more or less the point of nanosleep.
> If you start spinning right after the start of a timeslice,
> you could spin for close to an entire timeslice. On a modern
> multi-GHz CPU that's a tremendous number of wasted cycles (also
> doesn't help power consumption).
What does "right after the start of a timeslice" have to do with it?
Anyway, if the requested sleep time is "close to an entire timeslice"
then you obviously don't spin. Please don't manufacture nonsense
David A. Holland
Main Index |
Thread Index |