Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Task switching

Posted by Casper Hedegaard on October 6, 2010
Hi all.
I'm using FreeRTOS on an Atmel 32bit controller and want to switch quickly between a few tasks. As far as I can see, the taskYIELD() function only sets a task to be "ready", so if the task with the highest priority is calling taskYIELD(), it will take its turn again right away and not letting the other tasks have a go? Is there another function to call to let tasks with a lower priority have a go without using equal priorities, using vTaskDelay or changing priority and then use taskYIELD()?


RE: Task switching

Posted by Richard Damon on October 6, 2010
This sounds more like a program design issue, as you are excluding exactly the things to do what you want.

By the definition of Priority, a ready task of highest priority will be running. If your higher priority task to let a lower priority task run you need to ask is it really at the time a higher priority task? or is the issue that it really shouldn't be ready now? If it isn't the highest priority task, then some task needs it priority changed (either it or the other task that should be run now). If it really shouldn't be ready now, how do you determine when it will be ready again? If it is after a period of time, then it should delay, if it need information for something then it should wait on a queue or semaphore, that will be set when that data is available either by an interrupt or another task.

RE: Task switching

Posted by Casper Hedegaard on October 7, 2010
You are probably right. This isn't going to be a problem if the priorities are thought through. Thank you for your quick reply!

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

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner