Re: Threading, Sleeping, Scheduling

From: Tuomas Heino (iheino@cc.hut.fi)
Date: Sun Apr 16 2000 - 01:49:44 EST


On Thu, 13 Apr 2000, Matt Luker wrote:

> 2) Is the behavior I'm seeing simply the limitations of the linux
> threading coming out? Why can't the thread seem to sleep when I call
> a sleep of less than 5ms? Is there something strange going on in the
> native threads that would make them not respond to the sleep call?

round(int foo) { return (foo + 5) / 10; }
Looks like something is rounding it to 1/HZ resolution...

> 3) And ... is this just a java problem? Before you jump on this
> and say, "YES, YES, YES! For the love of God YES!" I did manage to get
> some late night access to a friend's Ultra Sparc 2 (it has two processors)
> and running the same application there experience NO problems and
> performance was stunning.

man 2 nanosleep:
BUGS
       The current implementation of nanosleep is based on the
       normal kernel timer mechanism, which has a resolution of
       1/HZ s (i.e, 10 ms on Linux/i386 and 1 ms on Linux/Alpha).
       Therefore, nanosleep pauses always for at least the speci­
       fied time, however it can take up to 10 ms longer than
       specified until the process becomes runnable again. For
       the same reason, the value returned in case of a delivered
       signal in *rem is usually rounded to the next larger mul­
       tiple of 1/HZ s.

> 4) Is this a hardware problem? I.e. despite being proud of my little
> setup, is it still not enough to support this application?

Depends on your viewpoint... Linux on Alpha h/w should at least handle
this situation 10x better ;)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:08 EST