All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Matthias Schneider <ma30002000@yahoo.de>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] Question about scheduling and signals
Date: Sat, 24 May 2014 23:17:37 +0200	[thread overview]
Message-ID: <53810C71.7090007@xenomai.org> (raw)
In-Reply-To: <1400964626.89274.YahooMailNeo@web171601.mail.ir2.yahoo.com>

On 05/24/2014 10:50 PM, Matthias Schneider wrote:
> ----- Original Message -----
> 
>> From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
>> On 05/24/2014 09:55 PM, Matthias Schneider wrote:
>>>  ----- Original Message -----
>>>>  From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
> [...]
>>>
>>>  Why priMAX_COUNT + 1? Shouldnt vTaskSuspend be triggered when 
>>>  *pulCounter == priMAX_COUNT (which is actually is once task 1 gets
>>>  scheduled while task 2 is raising abort - at least my debugger tells me 
>>>  it is).
>>
>> The task1 first suspends when pulCounter == priMAX_COUNT, right?
>> Then you wake it up, so, since there is a for loop, it will do
>>
>>>>>     (*pulCounter)++;
>>>>>     if( *pulCounter >= priMAX_COUNT )
>>>>>        vTaskSuspend(NULL); // -> wait for signal SIGRESM
>>
>> So, now task 1 is suspended again, and *pulCounter == priMAX_COUNT + 1
> 
> 
> 
> You are right, I forgot to include an essential piece of code in my 
> first snippet(sorry about that):
> 
> //Task 1, prio 1 / SCHED_FIFO
> 
> vTaskSuspend(NULL); // forgot this in my first snippet
> for(;;) {
> 
>   (*pulCounter)++;
>   if( *pulCounter >= priMAX_COUNT )
>      vTaskSuspend(NULL);
> }
> 
> //Task 2, prio 0 / SCHED_OTHER
> vTaskSuspendAll();
> vTaskResume(xLimitedIncrementHandle);
> xTaskResumeAll(); 
>                  
> if (ulCounter != priMAX_COUNT)
>   raise(SIGABRT);
> 
> 
> Now task will block in the first suspend. Task 2 will do its thing,
> and when task 2's priority gets lowered, I would expect task 1 being
> scheduled right away, increasing the counter up to priMAX_COUNT, before
> task 2 is scheduled again when task 1 enters the second vTaskSuspend.
> However, ulCounter seems to be 0 when SIGABRT is raised.

Are you running an uniprocessor, or multi-processor system?

-- 
                                                                Gilles.


  reply	other threads:[~2014-05-24 21:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-24 19:05 [Xenomai] Question about scheduling and signals Matthias Schneider
2014-05-24 19:37 ` Gilles Chanteperdrix
2014-05-24 19:55   ` Matthias Schneider
2014-05-24 20:01     ` Gilles Chanteperdrix
2014-05-24 20:50       ` Matthias Schneider
2014-05-24 21:17         ` Gilles Chanteperdrix [this message]
2014-05-25  8:05           ` Matthias Schneider

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=53810C71.7090007@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=ma30002000@yahoo.de \
    --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.