FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2015 Threads] queue priority Posted by ranco9 on March 25, 2015 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 Posted by rtel on March 25, 2015 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 Posted by ranco9 on March 25, 2015 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 Posted by rtel on March 25, 2015 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 Posted by ranco9 on March 26, 2015 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 Posted by davedoors on March 26, 2015 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|