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




Loading

taskYield in cooperative scheduling

Posted by Rocco Iacchetti on August 28, 2008
I'm running freeRTOS in cooperative scheduling to serve an ultra low-power remote sensor.

Now, if an higher priority task decides to suspend itself for a given amount of time, CPU is correctly given to a lower priority task. Suppose now that the amount of time elapses and the lower priority task is still running, how can the higher priority one be woken up?
The timer interrupt routine just increment ticker. In the function called by this interrupt routine every task that has become ready is moved in ready list, but no taskYield is called. It seems to me that the increment ticker function should return if an higher priority task has been woken up, much like xQueueReceiveFromISR do, for example.
Same problem for xQueueSend (not ISR version). If a lower priority task wakes an higher priority one, there is no way to know if a taskYield should be called or not.

On the other way, simply calling taskYield in the ISR routine or after an xQueueSend works, but it is very inefficient. In fact if the calling task is already the higher one, this will do a useless SAVE/RESTORE context.
Why not provide a function call much like the xxxFromISR version?

Thanks to everyone will help me on this!
Rocco.

RE: taskYield in cooperative scheduling

Posted by Dave on August 28, 2008
Using the cooperative scheduler the tick interrupt will unblock the higher priority task when its delay time expires but will not start it running. The cooperative scheduler will only start the higher task running when the lower task either blocks or calls taskYIELD(). This is why its called cooperative, the switch to a higher priority task will not occur without the say so of the lower priority task. If you want the switch to happen automatically as soon as the higher priority task unblocks then you have to use the preemptive scheduler.

Be careful calling taskYield() from an ISR, some ports allow you to do this directly while other require a bit of special syntax to be used.


[ 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