Question about task scheduling and RTEMS target shell

Fernando RUIZ CASAS correo at fernando-ruiz.com
Mon Jun 23 07:06:16 UTC 2003


On Thu, 19 Jun 2003 12:56:26 -0500, Joel Sherrill wrote:

> 
> 
> 
> mikeci at acm.org wrote:
> > 
> > Hi!
> > 
> > I have a following problem:
> > 
> > There are three tasks in the system:
> > 
> > TA1 - with priority 95 (highest). This task has a loop in which there is a
> > call to rtems_wake_after(2)
> > TA2 - with priority 100. This task has a loop in which there is a call to
> > rtems_wake_after(0)
> > TA3 - shell (it is a rtems shell found in libmisc) with priority 100. It
> > call serial driver and loops until something is typed on the terminal.
> > 
> > Now, all three of them are created with RTEMS_PREEMPT and RTEMS_TIMESLICE.
> > ---------------------------------------------------------------------------
> > Also interesting is that when you run a "task" command in the shell, task
> > flags are never changed and are always displayed as "P:T:nA". This is not
> > correct, because default setting for a task should be "P:nT:A". There is
> > also a bug in a shell:
> >

rtems_shell only calls to rtems_monitor. Where is the bug?

 
> > in the function register_cmds this is a correct code:
> > 
> >         command = rtems_monitor_commands;
> >         while(command->command)
> >         {
> >                 if(strcmp("exit", command->command))        /* Exclude
> > EXIT (alias quit) */
> >                         shell_add_cmd(command->command, "monitor",
> > command->usage, main_monitor);
> >                 command = command->next;
> >         };
> > 
> > while command must check for command->command == NULL, otherwise you will
> > have problems with strcmp comparing string with NULL. On my system this
> > cause an exception.
> 
The only posibility for a command->command = NULL is the call with NULL parameter.
The patch is a good idea.

> Could you please provide a diff?
> 
> > ---------------------------------------------------------------------------
> > Now description about the problem with tasks:
> > 
> > What hapens is that task 2 is never scheduled if its priority is 100. If I
> > lower priority of the shell to 101 then shell is never scheduled. Can you
> > give me sugestions on how to solve this problem?
> 
Always the same problem. 

You need put the events or rtems_system calls in order to obtain the control if you code have loops.


By example: A comunications dispatcher have a loop waiting the input queue.
The rtems_system call waits for you.

When the input is ready your shell stops until the dispatch loop ends.

In other case all your tasks need the same priority in order to share the CPU time.


> That's the defined behavior.  rtems_task_wake_after(0) only yields to
> tasks of equal or greater importance.  See this for more info:
> 
> http://www.oarcorp.com/rtemsdoc-current/html/c_user/c_user00060.html
> 
> The paragraph of interest is:
> 
> =============
> A task calling the rtems_task_wake_after directive with a delay interval
> of RTEMS_YIELD_PROCESSOR ticks will yield the processor to any other
> ready task
> of equal or greater priority and remain ready to execute. 
> =============
> 
> -- 
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel at OARcorp.com                 On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> Support Available                (256) 722-9985

51, Le clos des Gênets
Rue de la gare
69730 Genay
France
EMAIL: correo at fernando-ruiz.com 



More information about the users mailing list