[SOLVED] Dynamic size queue messages

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Dynamic size queue messages

    I had a question about queues in embOS and it's ability to handle different size messages.

    When I think of a queue message implementation, I think of a ring buffer. It will have a head and tail pointer and data pushed to the ring buffer will wrap around to the start of the buffer again. Most Queues, like FreeRTOS does not allow dynamic size messages like this, because if the queue is an integer multiple of the message size, all messages will always fit evenly in the queue and when the pointer wraps around it will be the start of a new message. All messages will be in one contiguous chunk of memory. A message will never have to wrap around to the beginning to finish storage.

    Since embOS can handle different size messages, how does it handle that wrap around event if the messages pushed doesn't fit evenly within the buffer? Since embOS reads by pointer and not by copy, and there is no way we can wrap around ourselves because we don't have access to the head and tail pointers and such.

    Is it the developers responsibility to make sure all messages fit evenly within the queue buffer size? If that's the case, what is the point of allowing different size messages in the first place?

    Or can it truly handle dynamically sizes messages as long as its size is less than the queue size?
  • Dear ptiguitardenver,

    Thanks for your inquiry.

    With embOS, users may choose between two distinct approaches: mailboxes and queues.
    While mailboxes work on fixed size messages only, a queue with embOS does in fact accept messages of variable size and will handle those dynamically.
    That, however, does not mean one single message may wrap around the ring buffer: Instead, if no sufficient space for the particular message is available at the end of the buffer, embOS will try to store the entire message at the beginning of the buffer. If that, too, lacks sufficient space, the message is not stored. It then depends on the the used API function whether the calling task is blocked or the function returns with an appropriate return value.

    Does this answer your question? Please let me know if I can be of any further help.

    Best regards,
    Martin

    PS: Since I couldn't find your data within our registration, I assume you're evaluating embOS at this point? If so, please also do not hesitate tocontact us if there's something we could help you with during your evaluation.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.