This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Showstopper for 2.1.3


Hi,

>I foresaw that the tight loop might not completely eliminate the ``time
>dilation'' problem when the condition sleep receives many signal
>interrupts, and have a ready solution for that.

If you read the bug reports 1597 and 1598 closely you will see that the
problem is not just time dilation but a real bug in the kernel's
implementation of nanosleep.  Your tight loop should have worked with
possibly just a bit of extra time involved because of not counting from
time when exiting and looping around to the next call to nanosleep.

Unfortunately, it is just not lost time outside the nanosleep call but the
remaining time is actually increasing slightly when time is converted to
jiffees and back to time again in the kernel when nanosleep is interrupted.
This really needs to be fixed in the kernel.

Your second approach given below should be okay because of the absolute
timeout but at this point I am just happy that something is functioning in
pthread_cond_timedwait so as far as I am concerned leaving it the way it is
for the glibc 2.1.3 branch is fine with me.

Since your change is mainly cosmetic can't any further changes wait until
glibc 2.2?

If you do decide to change linuxthreads once again, please let me know
before glibc 2.1.3 goes final so that I can recheck everything one more
time (arrgghh).

  We really can't afford to have a broken glibc on powerpc when it comes to
native threads (which haven't worked completely on glibc since 2.1.1).

Thanks,

Kevin



>
>One simple way to address the is to change the loop from:
>
>    while (__libc_nanosleep(&reltime, &reltime) == -1)
>	; /* nothing */
>
>to one which always recalculates the remaining sleep time:
>
>    while (__libc_nanosleep(&reltime, NULL)) {
>	/* call gettimeofday */
>	/* compute new sleep reltime */
>    }
>
>This should eliminate the time dilation, while keeping the loop small.  I was
>hoping that this wouldn't be necessary.
>
>I'm ashamed to admit that I didn't test the code well enough for the time
>dilation problem; that is to say, I didn't send it enough signals per
>second to
>see a difference.
>
>Anyway, I'll get right on it; it shouldn't take long.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]