[gambit-list] Problem in thread-sleep! may be a poor implementation of the select system call
vasil
vasil.s.d at gmail.com
Wed Jan 28 02:13:50 EST 2009
I consider linux RT kernel is somewhat unusual.
Here is result of select-test.c on my Linux machine:
$ time ./a.out
real 0m10.015s
user 0m0.000s
sys 0m0.002s
$ uname -a
Linux cassiopea 2.6.22-16-rt #1 SMP PREEMPT RT Mon Nov 24 19:03:10 GMT
2008 x86_64 GNU/Linux
Linux distro is Ubuntu 7.10 with RT linux kernel on laptop with Core 2
Duo in AMD64 mode.
When I run scheme code, I've got a value of n 1001 or 1002.
Vasil
> David St-Hilaire was experimenting with the following program:
>
> (define n 0)
>
> (thread-start!
> (make-thread
> (lambda ()
> (let loop ()
> (set! n (+ n 1))
> (thread-sleep! .0001)
> (loop)))))
>
> (thread-sleep! 1)
>
> (pp n) ;; expected value of n is approximately 10000
>
> The value printed for n on his Linux computer is approximately 100.
> When I try the program on my Mac OS X computer I get a value much closer
> to the expected 10000.
>
> After digging around it seems that the resolution of the "timeout"
> parameter to the "select" system call (which is used by the scheduler to
> wait for I/O and/or a timeout) can vary greatly from one OS to another.
>
> I'm curious to know how well other operating systems handle the
> timeout. So, if you have access to some unusual operating system, could
> you try the above program and report back what value is printed?
>
> I also wrote the C program below to test the resolution of select's
> timeout. You can try that too.
>
> Marc
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
More information about the Gambit-list
mailing list