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?
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?