Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - thread scheduling jitter question: (11 Items)
   
thread scheduling jitter question  
I have 3 processes each running a number of threads.  I have some of the threads running at a higher priority and system
 scope.  some of the threads (including those running at higher priorities) are communicating over ethernet.  I have an 
SMP x86 box with two gigabit ethernet ports.  I am running the round robin scheduler.

I am using timers to block the thread to run at 250, 500, etc. milliseconds.  I expected to see the intervals be very 
close to the proscribed value.  That is, I expected to see numbers close to 250 milliseconds, etc. but instead I see a 
significant amount of jitter.  In some cases a couple of hundred milliseconds, normally though about 5 milliseconds plus
/minus the timeout value.

One thread I have raised to 255 to see if that made any difference.  It still has a great deal of jitter.  I am very 
surprised.

Is this normal for QNX or am I doing something wrong?

THanx
Tim
Re: thread scheduling jitter question  
Try disabling "legacy USB support" in your bios.

Tim Gessner wrote:
> I have 3 processes each running a number of threads.  I have some of the threads running at a higher priority and 
system scope.  some of the threads (including those running at higher priorities) are communicating over ethernet.  I 
have an SMP x86 box with two gigabit ethernet ports.  I am running the round robin scheduler.
> 
> I am using timers to block the thread to run at 250, 500, etc. milliseconds.  I expected to see the intervals be very 
close to the proscribed value.  That is, I expected to see numbers close to 250 milliseconds, etc. but instead I see a 
significant amount of jitter.  In some cases a couple of hundred milliseconds, normally though about 5 milliseconds plus
/minus the timeout value.
> 
> One thread I have raised to 255 to see if that made any difference.  It still has a great deal of jitter.  I am very 
surprised.
> 
> Is this normal for QNX or am I doing something wrong?
> 
> THanx
> Tim
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post9634
> 
Re: thread scheduling jitter question  
Thanx.  That feature is already disabled in the cmos.  Interesting though, at times the system seems to slow down and 
become unusable.  At those times I run hogs and find that the io-usb is the main culprit.  I am not using anything USB 
directly, the keyboard, etc is PS2, there are not external devices using USB.

Any other thoughts?  Sounds like you don't expect that much jitter normally?

Thanx
Tim
Re: thread scheduling jitter question  
See http://en.wikipedia.org/wiki/System_Management_Mode.  This "feature" can "steal time" from the o/s without its 
knowlege.  The gaps can be sizeable.

You can likely put the same program on a different pc motherboard and find the jitter is gone.  (This has been my 
experience)  It seems that it is not possible to disable SMM on some motherboards.
Re: thread scheduling jitter question  
Thanx.  I'll look into that.

Tim
Re: thread scheduling jitter question  
FYI...

I switched the scheduling algorithm and it made a significant difference.  I was using Round Robin and switched to FIFO.
  It makes sense in my case, but the FIFO eliminated the jitter problems completely.
Re: thread scheduling jitter question  
So you had a single thread running at 255 that exhibited jitter, and if you change that thread from Round Robin to FIFO,
 the jitter goes away?

> FYI...
> 
> I switched the scheduling algorithm and it made a significant difference.  I 
> was using Round Robin and switched to FIFO.  It makes sense in my case, but 
> the FIFO eliminated the jitter problems completely.
RE: thread scheduling jitter question  
No, I had 1 thread at 255, a few threads at above normal (12), and a
couple of threads at normal.  All the threads exhibited jitter including
the thread at 255.  I switched all the threads to FIFO and all the
jitter went away.  I would expect that from all the threads except the
255 thread.  I would have thought that that would be consistent no
matter what.  

Since I'm sharing resources it makes sense that the other threads
exhibited some jitter, but not the 255 thread.

Tim

-----Original Message-----
From: Martin Doane [mailto:martin.doane@dematic.com] 
Sent: Monday, July 21, 2008 8:27 AM
To: ostech-core_os
Subject: Re: thread scheduling jitter question

So you had a single thread running at 255 that exhibited jitter, and if
you change that thread from Round Robin to FIFO, the jitter goes away?

> FYI...
> 
> I switched the scheduling algorithm and it made a significant
difference.  I 
> was using Round Robin and switched to FIFO.  It makes sense in my
case, but 
> the FIFO eliminated the jitter problems completely.


_______________________________________________
OSTech
http://community.qnx.com/sf/go/post10807
Re: thread scheduling jitter question  
Is the 255 thread holding any shared resources that would boost the lower threads?

Tim Gessner wrote:
> No, I had 1 thread at 255, a few threads at above normal (12), and a
> couple of threads at normal.  All the threads exhibited jitter including
> the thread at 255.  I switched all the threads to FIFO and all the
> jitter went away.  I would expect that from all the threads except the
> 255 thread.  I would have thought that that would be consistent no
> matter what.  
> 
> Since I'm sharing resources it makes sense that the other threads
> exhibited some jitter, but not the 255 thread.
> 
> Tim
> 
> -----Original Message-----
> From: Martin Doane [mailto:martin.doane@dematic.com] 
> Sent: Monday, July 21, 2008 8:27 AM
> To: ostech-core_os
> Subject: Re: thread scheduling jitter question
> 
> So you had a single thread running at 255 that exhibited jitter, and if
> you change that thread from Round Robin to FIFO, the jitter goes away?
> 
>> FYI...
>>
>> I switched the scheduling algorithm and it made a significant
> difference.  I 
>> was using Round Robin and switched to FIFO.  It makes sense in my
> case, but 
>> the FIFO eliminated the jitter problems completely.
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post10807
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post10808
> 
RE: thread scheduling jitter question  
There are no mutexes or anything of that sort, they do all use Ethernet
sockets, message pulses and timers.  There is nothing I can think of
that would should interrupt the 255 thread and nothing for which it
should have to wait while elevating another thread.

Tim

-----Original Message-----
From: Colin Burgess [mailto:cburgess@qnx.com] 
Sent: Monday, July 21, 2008 12:44 PM
To: ostech-core_os
Subject: Re: thread scheduling jitter question

Is the 255 thread holding any shared resources that would boost the
lower threads?

Tim Gessner wrote:
> No, I had 1 thread at 255, a few threads at above normal (12), and a
> couple of threads at normal.  All the threads exhibited jitter
including
> the thread at 255.  I switched all the threads to FIFO and all the
> jitter went away.  I would expect that from all the threads except the
> 255 thread.  I would have thought that that would be consistent no
> matter what.  
> 
> Since I'm sharing resources it makes sense that the other threads
> exhibited some jitter, but not the 255 thread.
> 
> Tim
> 
> -----Original Message-----
> From: Martin Doane [mailto:martin.doane@dematic.com] 
> Sent: Monday, July 21, 2008 8:27 AM
> To: ostech-core_os
> Subject: Re: thread scheduling jitter question
> 
> So you had a single thread running at 255 that exhibited jitter, and
if
> you change that thread from Round Robin to FIFO, the jitter goes away?
> 
>> FYI...
>>
>> I switched the scheduling algorithm and it made a significant
> difference.  I 
>> was using Round Robin and switched to FIFO.  It makes sense in my
> case, but 
>> the FIFO eliminated the jitter problems completely.
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post10807
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post10808
> 

_______________________________________________
OSTech
http://community.qnx.com/sf/go/post10829
Re: thread scheduling jitter question  
At this point I would recommend using a kernel trace.  The lowest impact method
would be to use a large kernel ring buffer, if you have the available memory.

Next on the list would be what is called direct mapped mode.  You need to specify
a maximum size for the logfile and them also pass -M - note that each time a buffer
is copied out you will get an unexplained 'pause' in the logfile.  Just be aware
of that effect when intepreting the results.

If you need help interpreting the logfile you can send it to me.  Make sure you compress
it (they compress VERY well :-)

Colin

--
cburgess@qnx.com

Tim Gessner wrote:
> There are no mutexes or anything of that sort, they do all use Ethernet
> sockets, message pulses and timers.  There is nothing I can think of
> that would should interrupt the 255 thread and nothing for which it
> should have to wait while elevating another thread.
> 
> Tim
> 
> -----Original Message-----
> From: Colin Burgess [mailto:cburgess@qnx.com] 
> Sent: Monday, July 21, 2008 12:44 PM
> To: ostech-core_os
> Subject: Re: thread scheduling jitter question
> 
> Is the 255 thread holding any shared resources that would boost the
> lower threads?
> 
> Tim Gessner wrote:
>> No, I had 1 thread at 255, a few threads at above normal (12), and a
>> couple of threads at normal.  All the threads exhibited jitter
> including
>> the thread at 255.  I switched all the threads to FIFO and all the
>> jitter went away.  I would expect that from all the threads except the
>> 255 thread.  I would have thought that that would be consistent no
>> matter what.  
>>
>> Since I'm sharing resources it makes sense that the other threads
>> exhibited some jitter, but not the 255 thread.
>>
>> Tim
>>
>> -----Original Message-----
>> From: Martin Doane [mailto:martin.doane@dematic.com] 
>> Sent: Monday, July 21, 2008 8:27 AM
>> To: ostech-core_os
>> Subject: Re: thread scheduling jitter question
>>
>> So you had a single thread running at 255 that exhibited jitter, and
> if
>> you change that thread from Round Robin to FIFO, the jitter goes away?
>>
>>> FYI...
>>>
>>> I switched the scheduling algorithm and it made a significant
>> difference.  I 
>>> was using Round Robin and switched to FIFO.  It makes sense in my
>> case, but 
>>> the FIFO eliminated the jitter problems completely.
>>
>> _______________________________________________
>> OSTech
>> http://community.qnx.com/sf/go/post10807
>>
>>
>> _______________________________________________
>> OSTech
>> http://community.qnx.com/sf/go/post10808
>>
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post10829
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post10848
>