Re: Problems with fast timeouts



Am Sonntag, 5. Januar 2003 01:40 schrieb Paul Davis:
> >  I wanted my timeout function to be called 200 times per second. Another
> > word s, my timeout function to be called every 5 miliseconds. However,
> > when I mesur ed the intervals with gettimeofday I found out that the
> > timeout function was c alled ca every 20ms. My timeout function exectutes
> > within 20microseconds. Is i t a bug in GTK+ or am I doing something
> > wrong? I use GTK+ 1.2.
>
> [ i am assuming that you are working on linux, which might be a big
>   assumption. if not, then ignore all that i write here. ]
>
> you're using a multitasking, multiuser operating system with a
> scheduling granularity of 10ms. the kernel will to honor the 5ms
> request but will fail to provide it because it only inspects the timer
> queues 100 times a second. unless you build/use a kernel with HZ=1000,
> and/or use real-time scheduling, nothing can get you timing intervals
> of less than 10ms under linux. your 20ms timing interval is probably a
> reflection of average times.
>
> --p

Even if you are using windows, you have a multitasking operating system with a 
special interrupt every 10ms that selects the next thread.

Karsten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]