queue priority
Hi
I am new to RTOS and looking for best way to implement the next:
Allowing permission to write to a queue with no interruptions (writing packets) and a first come first served policy (no matter the task priority)
While waiting for the permission the task should be blocked
What do you think?
Thanks & Best Regards
Ran
queue priority
I’m afraid I don’t understand your requirements. Are you talking about FreeRTOS queues? So writing to the queue using xQueueSend()? If so then any task can write to the queue, but only the highest priority task will be running, so the highest priority task will always write first. Assuming you are writing to the back of the queue (xQueueSend() or xQueueSendToBack()) then the queue will act as a FIFO. Data will come out in the same order it went in. As far as ready from the queue – if more than one task is attempting to read from the queue it is always the highest priority task that will read first.
Does that answer the question?
Regards.
queue priority
Hi
Thank you for your kind help
Yes i am talking about freeRTOS queue so using xQueueSend() but i would like to limit writing to it to only one task at a time at a first come first serve priority regardless of the task priority
To use an analogy, same as in a bank with one casheer, you can deposit only when its your turn and no cutting in line regardless your “priority” 🙂
Thanks again
Ran
queue priority
The queue handles all mutual exclusion issues for you – you do not need
to worry about more than one task trying to access the queue at the same
time. As far as which task will actually write to the queue – that is
handled by the priority of the task. The scheduler will always run the
highest priority task that is able to run – if that task is writing to a
queue then the write will effectively be atomic – that is – it can’t be
interrupted by another task writing to the same queue.
queue priority
Thanks again
Queue is wrriten packets so i am guessing the mutual exclusion won’t work. I guess i will use a binary semaphore to restrict access and forgo the “first come first served” requirement and leave it to the task priority
Best Regards,
Ran
queue priority
Mutual exclusion will always work for a single queue write. Are you wanting mutual exclusion across more than one write, so you want a task to write to the queue say 5 times without another task writing? Can you post a code snippet so we can understand better what you want to do.