All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Sherk Chung <sherk.chung@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Sharing data between multiple Xenomai tasks in the	same process
Date: Mon, 05 Apr 2010 00:43:46 +0200	[thread overview]
Message-ID: <4BB91622.9020807@domain.hid> (raw)
In-Reply-To: <2319761F7FA0D1479BA77EC2E0A8E7BCDD1848@domain.hid>

Sherk Chung wrote:
> Hi folks, I have some basic questions regarding having multiple task
> threads running in a Xenomai process. 
> 
>  
> 
> We would like to have a Xenomai process with multiple threads (tasks). 
> The primary task needs to hard-real-time, the others secondary ones will
> be using non-real-time drivers so they will be degraded to
> soft-real-time.  In order to share information between all the tasks, we
> are thinking of doing something simple, such as having a global
> structure that all threads can access.  I understand that we’ll need
> mutexes to preserve data integrity, and that the primary task might be
> caught waiting for a lock to release which might cause timing jitter. 
> But assuming we have that issue under control, are here any other
> Xenomai related issues that we should be aware of that might cause the
> hard-real-time task to degrade to soft-real-time by doing this?
> 
>  
> 
> Some things I’d like to verify:
> 
> -        It’s generally ok to run multiple Xenomai tasks within a single
> process.
> 
> -        If one of the secondary tasks is degraded to soft-real-time,
> the degradation will be limited only to that particular secondary task,
> not to the entire process (so the primary thread will remain hard-real-time)
> 
> -        Having a global structure that all tasks can access is an
> acceptable way to share data across Xenomai tasks (no
> pipes/queues/sharedmem necessary in this scenario)
> 
> -        There is no risk of the primary task degrading to
> soft-real-time by sharing a global structure with the secondary tasks
> that are degraded to soft-real-time
> 
>  
> 
> I’m guessing there is no issue but just wanted to make sure.

Hi,

It is Ok to protect shared data between a critical task and a non
critical task with a mutex, provided that:
- you enable priority inheritance for the mutex;
- the non critical thread never calls a Linux service while holding the
mutex.

Xenomais is able to detect such situation and to send the faulting
thread a signal in that case: enable CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX
in the configuration, and set, for the critical thread, the T_WARNSW bit
with rt_task_set_mode if using the native API, or the PTHREAD_WARNSW bit
with pthread_set_mode_np if using the POSIX API.

-- 
					    Gilles.



      reply	other threads:[~2010-04-04 22:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-04 17:18 [Xenomai-help] Sharing data between multiple Xenomai tasks in the same process Sherk Chung
2010-04-04 22:43 ` Gilles Chanteperdrix [this message]

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=4BB91622.9020807@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=sherk.chung@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.