All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Levesque <vleves@domain.hid>
To: Jan Kiszka <kiszka@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] How to implement a GUI for RT apps?
Date: Tue, 25 Oct 2005 15:22:03 -0700	[thread overview]
Message-ID: <435EB00B.4040407@domain.hid> (raw)
In-Reply-To: <435DF423.5000800@domain.hid>

Hi Jan,

>...and hopefully do not call any non-rt functions while holding the
>lock. Note that you can install a SIGXCPU handler to catch such
>potential accidental violations. Likely not needed if you only copy some
>data between the shared objects and your local buffers (all locked into
>memory - mlockall?).
>  
>
What do you mean by non-rt function? System calls? Functions that take a 
lot of time to run? Unless I made some mistakes, I'm only doing simple 
computations and copying data while mutexes are locked. I'm also using 
mlockall().

What would be the effect otherwise? I assume it would slow things down 
(by taking too long or switching to secondary mode) and possibly starve 
the rest of the system (freeze). I'm currently getting segfaults...

>>To summarize,
>>
>>1. What's the best way to implement a GUI for a RT app?
>>    
>>
>
>Depends too much on your requirements, GUI toolkit, etc. to give a
>general statement here.
>  
>
Good point. I guess the real question is: what are my options?

A few words about my needs. I'm a grad student in a research lab 
specializing in experimental haptic devices (computer interfaces for the 
sense of touch). I've been writing RT software to control different 
pieces of hardware. The software is for the most part for prototypes and 
will never leave the lab. The specs are constantly changing and I need 
to be able to continuously refactor and extend my code. My GUIs are 
mainly used to modify parameters and determine what goes on in RT 
control loops. I also give feedback with widgets and opengl drawings.

I could use the traditional decoupled approach (two processes) but that 
imposes some limits on what can be done fast. It essentially means that 
I need to design some kind of communication protocol between my RT and 
"non-RT" processes using queues or shared  memory. It's not that 
difficult but it complicates things and discourages changes to the 
software once finished. This approach can also quickly lead to very ugly 
hacks and workarounds when you can't afford to spend much time 
refactoring. It's not uncommon to see huge "do-it-all" structures with 
obsolete fields being passed around to save development time.

The approach that I'm using is more risky but it has many advantages 
(if/when it works). After all, there's a reason why multithreaded apps 
and frameworks like CORBA are popular...

Some information about my development env.:

OS: Ubuntu Linux 5.04 / 5.10
Kernel: 2.6.13 with ipipe adeos patch
RT: RTAI/fusion 0.9
Language: C++
GUI: gtkmm and gtkglextmm

>>2. Is my approach "legal" in fusion/xenomai?
>>    
>>
>
>Sounds sane to me. Which fusion version are you using? Already tried to
>update some component (kernel, patch, fusion/xenomai) and watch
>potential changes?
>  
>
Just to be sure we're clear: I have two tasks reusing the same RT_MUTEX 
structure, not two structure with the same content. That is allowed?

I didn't try to change much at this point. In fact I had to go back to 
my old linux distribution for the time being. I was using RTAI/fusion 
0.9. I switched to Xenomai 2.0 last night.

>>3. I remember reading that RTAI and X don't play well together. Is that
>>the case with Xenomai? Will things be better if I use the two-processes
>>approach?
>>    
>>
>
>Not a general problem, but a specific one related to certain graphic
>cards and drivers (don't ask me which, we are only using head-less or
>console-based boxes here).
>
That's good to know. I think I figured out why my program was sometimes 
freezing *before* the upgrade. It was unrelated to any problems with X.

Another question: Is there any restrictions on the use of the "new" 
operator in a RT task (or after calling mlockall)? That's the other 
possible culprit I had in mind....

Thanks a lot for your help!

Vincent Levesque
vleves@domain.hid


  reply	other threads:[~2005-10-25 22:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-25  0:34 [Xenomai-help] How to implement a GUI for RT apps? Vincent Levesque
2005-10-25  9:00 ` Jan Kiszka
2005-10-25 22:22   ` Vincent Levesque [this message]
2005-10-25 20:51     ` Jan Kiszka
2005-10-25 10:23 ` Ignacio García Pérez
2005-10-25 10:29   ` Jan Kiszka
2005-10-25 15:33     ` Ignacio García Pérez
2005-10-25 15:59       ` Jan Kiszka
2005-10-26  0:06         ` Vincent Levesque
2005-10-25 21:33           ` Jan Kiszka
2005-10-25 22:07             ` Hannes Mayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=435EB00B.4040407@domain.hid \
    --to=vleves@domain.hid \
    --cc=kiszka@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.