domenico.dileo | 4 Jun 2012 23:29
Picon
Favicon

Clarification on Rate montonic

Hello,
With the code hereafter, I run two periodic tasks (PER0 and PER1)
and scheduled them with the rate monotonic.
Also, a log of the excution follows the code.
PER0 has period 6000 ticks, while PER1 215.
Questions:
a) Since PER0 's pariod >> PER1's period should be PER1
the first to be scheduled?
According to the log, PER0 is the first one
b) how should I modify the code in order to have
PER1 scheduled before PER0?
Of course if I swap periodic_task(task_id[0], 6000);
with periodic_task(task_id[0], 215) I can observer
PER1 scheuled before PER0.
It seems that the first task to be scheduled
is the first to execute (with the call to the function
rtems_rata_monotonic_period).
Thank you in advance,

****************************************************
init.c code
****************************************************

...

  int i = 0;
  int l = 1;
  for(i; i< 3; i++){
	task_names[ i ] = rtems_build_name( 'P', 'R', '0'+i , ' ' );
	status = rtems_rate_monotonic_create(task_names[i], &task_id[i]);
(Continue reading)

Sebastian Huber | 5 Jun 2012 09:32
Picon
Favicon

Re: Clarification on Rate montonic

Hello,

before the call to rtems_rate_monotonic_period() the task is scheduled using 
the normal priority based scheme.  I suppose all your rate monotonic task are 
created with the same initial priority.  The rtems_task_start() will append the 
task to the ready queue of the corresponding priority, see also 
_Scheduler_priority_Ready_queue_enqueue().  Thus you can control which task 
runs first (order of start calls).

--

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@...
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
rtems-users mailing list
rtems-users@...
http://www.rtems.org/mailman/listinfo/rtems-users

domenico.dileo | 5 Jun 2012 10:06
Picon
Favicon

Re: Clarification on Rate montonic

Dear Sebastian,

I'm using RTEMS 4.10.2. I looked up for
_Scheduler_priority_Ready_queue_enqueue function
but I didn't find it.
What version are you using?

Quoting Sebastian Huber <sebastian.huber@...>:

> Hello,
>
> before the call to rtems_rate_monotonic_period() the task is  
> scheduled using the normal priority based scheme.  I suppose all  
> your rate monotonic task are created with the same initial priority.  
>  The rtems_task_start() will append the task to the ready queue of  
> the corresponding priority, see also  
> _Scheduler_priority_Ready_queue_enqueue().  Thus you can control  
> which task runs first (order of start calls).
>
> -- 
> Sebastian Huber, embedded brains GmbH
>
> Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
> Phone   : +49 89 18 90 80 79-6
> Fax     : +49 89 18 90 80 79-9
> E-Mail  : sebastian.huber@...
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
(Continue reading)

Sebastian Huber | 5 Jun 2012 10:12
Picon
Favicon

Re: Clarification on Rate montonic

On 06/05/2012 10:06 AM, domenico.dileo@... wrote:
> Dear Sebastian,
>
> I'm using RTEMS 4.10.2. I looked up for
> _Scheduler_priority_Ready_queue_enqueue function
> but I didn't find it.
> What version are you using?

This function is new in 4.11.  In 4.10 it is _Thread_Ready().

--

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@...
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
rtems-users mailing list
rtems-users@...
http://www.rtems.org/mailman/listinfo/rtems-users

domenico.dileo | 5 Jun 2012 11:27
Picon
Favicon

Re: Clarification on Rate montonic

I'm sorry to bother you
but I can't find _Thread_Ready() either.
Please, can you tell me the file name?
Thank you

Quoting Sebastian Huber <sebastian.huber@...>:

> On 06/05/2012 10:06 AM, domenico.dileo@... wrote:
>> Dear Sebastian,
>>
>> I'm using RTEMS 4.10.2. I looked up for
>> _Scheduler_priority_Ready_queue_enqueue function
>> but I didn't find it.
>> What version are you using?
>
> This function is new in 4.11.  In 4.10 it is _Thread_Ready().
>
> -- 
> Sebastian Huber, embedded brains GmbH
>
> Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
> Phone   : +49 89 18 90 80 79-6
> Fax     : +49 89 18 90 80 79-9
> E-Mail  : sebastian.huber@...
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> rtems-users mailing list
> rtems-users@...
(Continue reading)

Sebastian Huber | 5 Jun 2012 11:32
Picon
Favicon

Re: Clarification on Rate montonic

On 06/05/2012 11:27 AM, domenico.dileo@... wrote:
> I'm sorry to bother you
> but I can't find _Thread_Ready() either.

How do you search?

grep -rl _Thread_Ready cpukit/
cpukit/score/inline/rtems/score/thread.inl
cpukit/score/include/rtems/score/thread.h
cpukit/score/src/threadrotatequeue.c
cpukit/score/src/threadready.c
cpukit/score/src/threadsetpriority.c
cpukit/score/src/threadrestart.c
cpukit/score/src/thread.c
cpukit/score/src/threadstart.c

> Please, can you tell me the file name?

cpukit/score/src/threadready.c

I suggest to use ctags or similar to navigate through the sources.

--

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@...
PGP     : Public key available on request.
(Continue reading)

Gedare Bloom | 5 Jun 2012 17:20
Favicon

Re: Clarification on Rate montonic

Hi,

Your code has a couple of bugs. See for example sp20 for how to
structure a typical RM application. One problem I see is that your
init task calls the periodic_task() function directly. Instead you
should be setting up a normal rtems_task_create/rtems_task_start with
periodic_task as the entry point, and periodic_task would: create an
rm timer, self-suspend so that all periodic tasks release
simultaneously (critical instant), and execute the periodic loops.
Init should either suspend indefinitely/delete itself or can be used
to stop the application similarly to how you have set it up with
wake_after.

-Gedare

On Mon, Jun 4, 2012 at 5:29 PM,  <domenico.dileo@...> wrote:
> Hello,
> With the code hereafter, I run two periodic tasks (PER0 and PER1)
> and scheduled them with the rate monotonic.
> Also, a log of the excution follows the code.
> PER0 has period 6000 ticks, while PER1 215.
> Questions:
> a) Since PER0 's pariod >> PER1's period should be PER1
> the first to be scheduled?
> According to the log, PER0 is the first one
> b) how should I modify the code in order to have
> PER1 scheduled before PER0?
> Of course if I swap periodic_task(task_id[0], 6000);
> with periodic_task(task_id[0], 215) I can observer
> PER1 scheuled before PER0.
(Continue reading)

domenico.dileo | 6 Jun 2012 11:05
Picon
Favicon

Re: Clarification on Rate montonic

Dear Sebastian and Gedare,

thank you for your comments.
I updated the code according to your suggestions
(at least I hope so). The cods is at the end of this message (with an
execution log as well).
In the init function 2 tasks, TA0 and TA1 are crated.
TA0 starts a periodic task,PER0, similarly TA1.
PER0 has period 6000 ticks and sleeps for 4000 ticks
PER1 has period 4000 ticks and sleeps for 2000 ticks

  I observer the following behavior:
TA0 and TA1 both created.
TA0 starts PER0.
PER0 executes (I choose to execute the task for 10 times)
Then everything stops.

Conversely, what I would like to see that
PR0 and PR1 are alternatively scheduled.
Can you help me out to understand where I'm mistaken?
Thank you in advance

******************************************************
init.c
******************************************************
int index = 0;
  for ( index; index < 2 ; index++ ) {
       task_names[ index ] =  rtems_build_name( 'T', 'A', '0'+index, ' ' );
       status = rtems_task_create(
       task_names[ index ],
(Continue reading)

Gedare Bloom | 6 Jun 2012 17:07
Favicon

Re: Clarification on Rate montonic

I don't see TA1 starting. You'll have to dig into that problem. I see
nothing immediately obvious.

On Wed, Jun 6, 2012 at 5:05 AM,  <domenico.dileo@...> wrote:
> Dear Sebastian and Gedare,
>
> thank you for your comments.
> I updated the code according to your suggestions
> (at least I hope so). The cods is at the end of this message (with an
> execution log as well).
> In the init function 2 tasks, TA0 and TA1 are crated.
> TA0 starts a periodic task,PER0, similarly TA1.
> PER0 has period 6000 ticks and sleeps for 4000 ticks
> PER1 has period 4000 ticks and sleeps for 2000 ticks
>
>  I observer the following behavior:
> TA0 and TA1 both created.
> TA0 starts PER0.
> PER0 executes (I choose to execute the task for 10 times)
> Then everything stops.
>
> Conversely, what I would like to see that
> PR0 and PR1 are alternatively scheduled.
> Can you help me out to understand where I'm mistaken?
> Thank you in advance
>
> ******************************************************
> init.c
> ******************************************************
> int index = 0;
(Continue reading)

domenico.dileo | 6 Jun 2012 17:58
Picon
Favicon

Re: Clarification on Rate montonic

Dear Gedare and all other interested users,
in the init there is a quite stupid bug,
  the for loop includes also the lines

status = rtems_task_wake_after(ticks_per_second*60);
// delete init task after starting the three working tasks
  rtems_rate_monotonic_report_statistics();
  status = rtems_task_delete( RTEMS_SELF );

which shouldn't be there.
anyway thank  you

Quoting Gedare Bloom <gedare@...>:

> I don't see TA1 starting. You'll have to dig into that problem. I see
> nothing immediately obvious.
>
> On Wed, Jun 6, 2012 at 5:05 AM,  <domenico.dileo@...> wrote:
>> Dear Sebastian and Gedare,
>>
>> thank you for your comments.
>> I updated the code according to your suggestions
>> (at least I hope so). The cods is at the end of this message (with an
>> execution log as well).
>> In the init function 2 tasks, TA0 and TA1 are crated.
>> TA0 starts a periodic task,PER0, similarly TA1.
>> PER0 has period 6000 ticks and sleeps for 4000 ticks
>> PER1 has period 4000 ticks and sleeps for 2000 ticks
>>
>>  I observer the following behavior:
(Continue reading)


Gmane