gen68360: tasks blocking

Ilya Alexeev ilya at continuum.ru
Thu Nov 15 13:47:42 UTC 2001


> Hi Ilya,
>
> > Hi all.
> >
> > To gen68360 users:
> >
> > I have created a set of tasks,
> > which are calling rtems_task_wake_after directive.
> > If the interrupt level of this tasks lower than
> > PIT interrupt level, then in some little time they become
>
> blocked,
>
> > i.e. scheduler does not get CPU time to them.
> > If the interrupt level of this tasks >= PIT interrupt level
> > then everything is fine.
> > Is this situation is correct or it is a bug in RTEMS?
>
> This situation is correct ;->
>
> You forgot, that at least one task has a higher priority: The
> "init" task by default gets a priority set to "1" which is
> highest priority available (maybe is 0 legal aswell?). So when
> you create and start your tasks normally and with priority 50,
> then they won't get any time, because the "init" task consumes
> it all in the "while" loop.
>
> Try adding a "rtems_task_wake_after" in the "while" loop of
> "init", this should help....

I am asking about the interrupt priority, not about tasks priority.
(Apropos, getchar in the while loop is not block the 'FAKE' tasks.)

> Bye,
> 	Thomas.
>
> > Simple example to demonstrate this:
> >
> >
> > init.c:
> > ~~~~~~~
> >
> > #include <rtems.h>
> > #include <rtems/cpuuse.h>
> > #include <stdio.h>
> > #include "system.h"
> >
> >
> > rtems_task fakeTask(rtems_task_argument argument)
> > {
> >     while(1)
> >     {
> >         rtems_task_wake_after(1);
> >     }
> > }
> >
> >
> > rtems_task Init(rtems_task_argument argument)
> > {
> >     rtems_id tid;
> >     int i;
> >
> >     puts("\nStarting test...");
> >
> >     for (i = 0; i < 10; i++)
> >     {
> >         rtems_task_create(rtems_build_name('F','A','K','E'),
>
> 50,
>
> >             RTEMS_MINIMUM_STACK_SIZE,
> >             RTEMS_DEFAULT_MODES |
> >             RTEMS_INTERRUPT_LEVEL(0),  /* < 4 - task blocks;
> >= 4 - all is OK
> > */
> >             RTEMS_DEFAULT_ATTRIBUTES, &tid);
> >         rtems_task_start(tid, fakeTask, 0);
> >     }
> >
> >     while(1)
> >     {
> >         getchar();
> >         CPU_usage_Dump();     /* to see tasks's CPU usage */
> >     }
> >
> >     rtems_task_delete (RTEMS_SELF);
> > }
> >
> >
> >
> > system.h:
> > ~~~~~~~~~
> >
> > #ifndef __SYSTEM_H_
> > #define __SYSTEM_H_
> >
> > rtems_task Init(rtems_task_argument);
> >
> > #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> >
> > #define CONFIGURE_MAXIMUM_SEMAPHORES                    10
> > #define CONFIGURE_MAXIMUM_TASKS                         10
> >
> > #define CONFIGURE_MICROSECONDS_PER_TICK                 1000
> >
> > #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> > #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> >
> > #define CONFIGURE_INIT
> >
> > #include <confdefs.h>
> >
> > #endif  /* __SYSTEM_H_ */
> >
> >
> >
> > Bye,
> >     Ilya.
>
> --------------------------------------------
> IMD Ingenieurbuero fuer Microcomputertechnik
> Thomas Doerfler           Herbststrasse 8
> D-82178 Puchheim          Germany
> email:    Thomas.Doerfler at imd-systems.de
> PGP public key available at: http://www.imd-
> systems.de/pgp_key.htm



More information about the users mailing list