Ales Bardorfer wrote:
> 
> Hi!
> 
> Is there a way to detect (and prevent) the CPU overload in RT thread?
> I've found no solutions in the archive.
> 
> Would something like this work?
> 
> while(1) {
>         ret = pthread_wait_np();
>         start_time = gethrtime();
> 
>         if (overload++) {
>                 suspend thread!
>         }
> 
>         // Do some RT work.
>         rt_step();
> 
>         rt_step_count++;
>         rt_task_spent_time += gethrtime() - start_time;
> 
>         overload--;
> }
> 
> If the  rt_step takes too long to finish, what exactly happens?
> The idea is to skip (miss) the overload--;
> 
> Is there any better solution to this overloading problem?
> 
> Ales

Hi Ales,

This isn't a direct answer to your question, but we've developed a
watchdog module for RTAI that will be included in the next release
(24.1.4). It can detect overrunning tasks (including itself) and can be
configured to take various actions (delete or suspend task, increase
task period, skip a frame, etc). You might get some clues from it. 

Best regards,
Ian
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to