Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


queue priority

Posted by ranco9 on March 25, 2015


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?


queue priority

Posted by ranco9 on March 25, 2015


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.

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists