All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Alessandro Pittaluga <xpit@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] RT_TASK descriptor question
Date: Sat, 25 Mar 2006 11:07:20 +0100	[thread overview]
Message-ID: <44251658.9040707@domain.hid> (raw)
In-Reply-To: <1143280058.14325.257499491@domain.hid>

Alessandro Pittaluga wrote:
> Hi,
> 
> In the native skin rt_task_create receives a pointer to a RT_TASK struct
> which must be allocated in permanent memory.
> So I thought that the address of this struct would be the task
> identifier used to be passed to the other rt_task functions.
> And it works in this way.
> 
> The strange thing is that rt_task_self does not return the same value of
> RT_TASK*, but allocates a new RT_TASK structure the first time it is
> called in a new task context.
> 
> Why? 
> 

Because the relevant bit of information is not the descriptor struct per 
se, but rather its contents. This way, one can point to the same object 
using a descriptor struct, regardless of the allocation context of such 
struct. This is particularly useful for sharing objects between 
different execution spaces: regardless of the layout of the descriptor 
or the context it has been created, one only has to know that the 
descriptor contains enough information to point back to the registered 
object; IOW, the descriptor address is not part of the indexing information.

Using this property, rt_task_self() can simply fill any descriptor 
_struct_ once, at the time of the first call for any given thread. The 
struct itself is part of TSD/PTD information, and has been pre-allocated 
at thread creation. This way, the kernel is only asked once for filling 
the struct on a pre-allocated memory area, and subsequent calls to 
rt_task_self() just return the PTD value associated with the descriptor 
struct key.

> Many thanks
> 
> Alessandro


-- 

Philippe.


      reply	other threads:[~2006-03-25 10:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-25  9:47 [Xenomai-help] RT_TASK descriptor question Alessandro Pittaluga
2006-03-25 10:07 ` Philippe Gerum [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=44251658.9040707@domain.hid \
    --to=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    --cc=xpit@domain.hid \
    /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.