Re: Suspending and Resuming a hard real time task

Paolo Mantegazza <[email protected]>
Newsgroups gmane.linux.real-time.rtai
Message-ID <[email protected]>
On 12/16/2015 03:35 PM, Jonas Schulze wrote:
>
> Hi,
>
> in my project I am using a soft real time task to perform some 
> computations and network communications, and a periodic hard real time 
> task in a different thread to perform other computations.
>
> For the network communications in soft real time I need to use an 
> third party API. Now the program crashed at random places with 
> “malloc() corruption (fast)” error. Our conclusion was that the 
> program crashes if the soft real time task is paused due to the 
> activation of the hard real time task, while it is carring out the 
> “read” or “write” network functions. So what we did is
>
> .
>
> .
>
> .
>
> Rt_task_suspend(hrt_task)
>
> Network read/write
>
> Rt_task_resume(hrt_task)
>
> .
>
> .
>
> .
>
> To ensure the hard real time task is never activated while the network 
> functions are at work. After using the suspend and resume the program 
> does not crash anymore.
>

What above conflicts with the idea of real time. In fact if you can 
suspend a hard real time task to let a soft real time run, you are 
forcing a priority inversion, i.e allowing hard real time to be blocked 
by a not hardened task.
If it works the you do not need hard real time and stay happy with plain 
Linux.

> My questions are
>
> 1.is this is the right way to prevent a periodic real time task from 
> interrupting another function?
>
One of the many possible,  but is a bit nonsensical.
>
> 2.After suspending and resuming, is the task still in hard real time 
> or do I need to make another call to make_hard_realtime()?
>
The hard real time state is not touched by a task suspend, whoever emits it.

> 3.Should I use rt_task_make_periodic() instead of rt_task_resume()?
>
No.

Paolo
>
> Thanks and Best Regards
>
> Jonas
>
> *---------------------------*
>
> *Jonas Schulze, M. Sc.*
>
> Technische Universität Darmstadt
>
> Flugsysteme und Regelungstechnik
>
> Otto-Berndt Straße 2
>
> 64287 Darmstadt, Germany
>
> Tel.: +49(0)6151/16-21077
>
> Fax:    +49(0)6151/16-21050
>
> E-Mail: [email protected] <mailto:[email protected]>
>
> URL: www.fsr.tu-darmstadt.de <http://www.fsr.tu-darmstadt.de/>
>
>
>
> _______________________________________________
> Rtai mailing list
> [email protected]
> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
What above conflicts with the idea of real time. In fact if you can 
suspend a hard real time task to let a soft real time run, you are 
forcing a priority inversion, i.e allowing hard real time to be blocked 
by a not hardened task.
If it works the you do not need hard real time and stay happy with plain 
Linux.

_______________________________________________
Rtai mailing list
[email protected]
https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.