problem in round robin scheduling with logMsg()
hi,
i tried implementing round robin scheduling among three
tasks which has
same priority. All the three tasks are only displaying some message no
other operations.
when i used printf() to display the messages everything is
working fine it is switching
from one task to another according to its time slice.
But when i used logMsg() to display these messages it is not
switching from
one task to another. Here round robin scheduling is not get
implemented.
Can anyone help me out to fix this problem?
Re: problem in round robin scheduling with logMsg()
Hi,
(This is from the manual):
-----------
Because logMsg( ) does not actually perform the output directly to the
logging streams, but instead queues the message to the logging task,
logMsg( ) can be called from interrupt service routines.
However, since the arguments are interpreted by the logTask( ) at the
time of actual logging, instead of at the moment when logMsg( ) is
called, arguments to logMsg( ) should not be pointers to volatile
entities (e.g., dynamic strings on the caller stack).
-----------
It seems that if a task1 calls logMsg(), the logTask() (high priority?)
may preempt task1. But after logTask() sleeps or blocks again, I think
that task1 will then run where it left off (instead of giving in to
task2)?
Maybe you can try using global or static local buffers as input to
logMsg().
Also try searching for "logMsg" in this group.
Hope this helps.
-Ronald
samrat wrote:[color=blue]
> hi,
> i tried implementing round robin scheduling among three
> tasks which has
> same priority. All the three tasks are only displaying some message no
> other operations.
> when i used printf() to display the messages everything is
> working fine it is switching
> from one task to another according to its time slice.
> But when i used logMsg() to display these messages it is not
> switching from
> one task to another. Here round robin scheduling is not get
> implemented.
>
> Can anyone help me out to fix this problem?[/color]
Re: problem in round robin scheduling with logMsg()
Could you give us more details? It's not logMsg() to switch
messages from one task to another. It's round robin scheduling to
allocate
CPU time for each task. You should check your code again because it's
not RR scheduing problem for sure.
samrat wrote:[color=blue]
> hi,
> i tried implementing round robin scheduling among three
> tasks which has
> same priority. All the three tasks are only displaying some message no
> other operations.
> when i used printf() to display the messages everything is
> working fine it is switching
> from one task to another according to its time slice.
> But when i used logMsg() to display these messages it is not
> switching from
> one task to another. Here round robin scheduling is not get
> implemented.
>
> Can anyone help me out to fix this problem?[/color]
Re: problem in round robin scheduling with logMsg()
samrat wrote:[color=blue]
> hi,
> i tried implementing round robin scheduling among three
> tasks which has
> same priority. All the three tasks are only displaying some message no
> other operations.
> when i used printf() to display the messages everything is
> working fine it is switching
> from one task to another according to its time slice.
> But when i used logMsg() to display these messages it is not
> switching from
> one task to another. Here round robin scheduling is not get
> implemented.[/color]
The only safe thing to use as argument to logMsg (during Round Robin
Sched (RRS) ), are literals - this is not really the case with
pre-emptive scheduling, as the logTask usually runs at the highest
priority (don't change that). The reason for this is that with RRS, one
is never sure whether the stack of the caller of logMsg are still
around when the actual string is processed. This can be a problem if
you use RAII (strings whose lifetime bounded to the stack of the caller
- either created on the stack, or bounded to the scope of the stack )
strings as argument to logMsg - especially when using RRS.
Kind regards,
Werner