All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Khalil GHORBAL <kg@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] handling threads within a pod
Date: Thu, 13 Jul 2006 11:11:19 +0200	[thread overview]
Message-ID: <44B60E37.7060207@domain.hid> (raw)
In-Reply-To: <44B60737.6050705@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 3478 bytes --]

Khalil GHORBAL wrote:
> Jan Kiszka wrote:
> 
>> Khalil GHORBAL wrote:
>>  
>>
>>> Hi,
>>>
>>> I'm trying to implement a new skin (IMA380) using xenomai framework.
>>>   
>>
>> Cool. Just learned that IMA380 is similar to ARNIC 653. Sounds quite
>> interesting. Will there be real partitioning? Will we get the chance to
>> see/use the result some day?
>>  
>>
> Thank you for your answer Jan.
> 
> As I'm not the only concerned I can't give an answer rightnow,
> but if it depends only on me, yes, I'll share my work with every body,
> hoping it'll be useful.

Well, if you need some more argument for persuading those who may
decide: A contributed skin will also be easier to maintain. We may have
to adapt interfaces during future development, and if your code is part
of Xenomai then, it will be included in the required changes. Or the
modification will be reconsidered if it harms your skin unacceptably.

> 
>>  
>>
>>> When creating multiple xnthreads within a pod,
>>> I didn't found a way to access or handle these threads.
>>> Threads are linked to the global queue of a pod but how can I access to
>>> the other fields of xnthread structure ?
>>>
>>> hope it was clear :)
>>>   
>>
>> Not really. Do you mean how to handle references to those threads, how
>> to pass them to the user and accept them back? Or do you mean how to
>> manipulate fields of the xnthread structure directly. The latter is
>> risky as you bypass the nucleus interface. Better check if some service
>> of the nucleus layer provide the required access. If not, elaborate what
>> kind of access you need.
>>  
>>
> I'll give an example to explain the issue:
> Assuming having multiple threads in our active pod, these threads can be
> in different states.
> The running thread have to get the *extinfo* field of thread named
> "COM_THREAD" (for example) if exists.

Looks like you'll be the first user of extinfo then. I wonder what it
should be useful for given that one normally embeds xnthread_t in a
container structure like this:

struct my_thread {
	xnthread_t thread_base;
	some_type some_additional_data;
};

Then, if you have a reference to a xnthread, you can easily resolve it
to your container thread:

my_thread_ptr = container_of(xnthread_ptr, struct my_thread,
			     thread_base);

To identify if this extension is valid, you can use the magic field in
xnthread (xnthread_get/set_magic).

[I'm picking on this as I feel like we could remove extinfo in the
future, but I might oversee some legitimate use-case right now.]

> 
> All services of the nucleus need a *xnthread_t* structure to identify
> the thread to treat, we can't have a list or something similar to sweep
> existing threads. All I've found is the global queue, doubly-linked and
> circular, which link all threads.
> So all informations I have is the number of threads and a way to go from
> one holder to another
> without really be able to identify the thread and read the other fields.

Again, you can use the magic field. Or you can start maintaining your
own list of threads. The posix skin does it like this.

> 
> I still misunderstood the function of global queue and how the pod
> schedule existing threads.

The global queue is mostly there for informative purposes, e.g. /proc
listings. There is also a usage scenario wrt round-robin. But scheduling
takes place based on the runqueues of each CPU.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2006-07-13  9:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-12 16:02 [Xenomai-help] handling threads within a pod Khalil GHORBAL
2006-07-12 16:23 ` Jan Kiszka
2006-07-13  8:41   ` Khalil GHORBAL
2006-07-13  9:11     ` Jan Kiszka [this message]
2006-07-14 15:30     ` Philippe Gerum
2006-07-14 15:58       ` Jan Kiszka
2006-07-14 19:04         ` Philippe Gerum
2006-07-17  7:45       ` Jan Kiszka
2006-07-17  8:04         ` Philippe Gerum

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=44B60E37.7060207@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=kg@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.