I have no idea what HZ is used on my kernel, but i think
i understand the problem now.

I still can reproduce it with this:

        double t, ct, ts;

        ct = nsec()*1e-6;
        t = ct + msec;

        for(;;){
                ts = t - ct;
                sleep(ts);
                ct = nsec()*1e-6;
                if(t <= ct){
                        t += msec;
                }
        }

The problem is that when sleep is a little bit too fast on every round,
t will never catch up with ct. so it sleeps shorter and shorter until
t - ct < 1.

It all works when changing t += msec to t = ct + msec. It may still
do a zero sleep, but the error will not add up.

making new kernel...

--
cinap
--- Begin Message ---
what is your HZ set at?  after chasing a few bugs like this,
i've set HZ=1000.  actually i first saw the idea in sam hopins'
work  there's no performance drag and 1 ms
sleeps do actually sleep.

- erik

--- End Message ---

Reply via email to