Re: Dumb RTOS Question



Dave wrote:
galt_57 wrote:

Starting on my first RTOS project and can't quite see the logic to the
interprocess communications. The Zilog RTOS offers message queues, but
if the queue is empty the reading process is suspended until something
shows up in the queue. Well sorry, that isn't good because my process
has multiple things it needs to monitor periodically. It can't get hung
on just one message queue. I thought a message queue would work or have
an option to work like a ring buffer but that does not seem to be the
case. My concept is to have this process check several "queues" and
then suspend for a safe amount of time before looping back to check them
again. Any sage advice appreciated. Thanks.

The function RZKReceiveFromQueue() includes a wait time parameter.

Also, from the ZiLOG Real-Time Kernel v2.0.0 Reference Manual, page 15:

"You can choose not to block on message queues to receive or send message
queue messages. When this option is chosen, a TIMEOUT error occurs if the
message queue is empty while receiving, or full while sending messages."

And there is also the RZKPeekMessageQueue() function which might do for
you.

If you were to block on each queue for one tick, wouldn't that be safe
since you say "suspend for a safe amount of time before looping back to
check them again"?

That is true. You have a good point. If I want to suspend for a period
of time then I ought to be able to use the timeout on each queue set to
half of that period. I just have not figured out this kooky RTOS stuff.
The peek command copies the entire message out of the queue, which
seems rather pointless. I just can't see the logic of not providing a
non-blocking way to determine if there are one or more messages in the
queue. I mean what is the point of that? Ring buffers worked fine for
talking to ISR's. Why aren't they good enough for an RTOS?

.



Relevant Pages

  • Re: ipc/msg.c "cleanup" breaks fakeroot on Alpha
    ... avoid taking a lock on a message queue that just got freed? ... queue after a grace period. ... "volatile" shouln't be necessary. ... or the target thread was destroyed before wake_up_process completed. ...
    (Linux-Kernel)
  • Re: Dumb RTOS Question
    ... shows up in the queue. ... I thought a message queue would work or have ... then suspend for a safe amount of time before looping back to check them ... I just have not figured out this kooky RTOS stuff. ...
    (comp.arch.embedded)
  • netstat issue on Tru64. Kernel bug?
    ... I have noticed that many people were faced to the "netstat hangs" ... If a process writes in a message queue in such way that it overflows ... bash$ overflowQ ...
    (comp.unix.tru64)
  • Re: Dumb RTOS Question
    ... interprocess communications. ... shows up in the queue. ... I thought a message queue would work or have ... if you have one RTOS task that's performing multiple ...
    (comp.arch.embedded)
  • Re: Need explaination of BeginInvoke timing
    ... it just queues the delegate invocation on the regular message queue for the control's owning thread. ... Actually, while you don't post enough code to be certain, it appears that the event handlers are just handlers for the regular Control events Enter, MouseUp, and MouseDown. ... The code is setting the flag, queuing a delegate that resets the flag which will be executed after all of the messages that are already in the queue, and then the remaining events are processed, including the MouseDown event and the delegate invocation that was queued via BeginInvoke. ...
    (microsoft.public.dotnet.languages.csharp)