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

best way to "switch" tasks

Posted by matejm on November 6, 2013

Hi, i have some problems how to "control" tasks... i have one main task which control others "reporting" tasks, which read data from sensors, sending data to server etc... but they'll run occasionally some of them will run once per day others few times on month

now i'm wondering how should i do that and why is one way better than other?

a) suspending/resuming tasks b) changing their priorities

i didn't find any specific info at http://www.freertos.org/a00112.html when should i use one of them... if i choose b) and raise priority to one task, scheduler won't run other task until i don't set low priority to it... what is diffrent if i choose way a) - i run task with highest priority and when is finished i suspend it...

best regards, Matej


best way to "switch" tasks

Posted by davedoors on November 6, 2013

If you need tasks to do these periodic actions then my answer assumes the functionality is unsuitable to be done in a software timer.

The other tasks must be tightly synchronized with the controlling task then you could have the other tasks suspend themselves when they have finished their action. The controlling task can then unsuspend them when it is time for them to perform their action again.


best way to "switch" tasks

Posted by matejm on November 6, 2013

Dave, thanks for reply, tasks - actions are not peridoic... i think that suspending tasks is best choose because task is in suspended state and scheduler doesn't have to mess with it (until i resume it )... if i changing a priority - task is in a Ready mode and scheduler will looking between more tasks (for each task at least one or more comparation)


best way to "switch" tasks

Posted by richard_damon on November 7, 2013

Generally i have tasks switch by having them wait on something (like a semaphore or queue) which tells them they have something to do. Trying to starts/stop tasks with resumes or priorities generally indicates that not enough effort has gone into figuring out when they are supposed to run and what they are supposed to do.

Tasks in the Blocked state don't take attention of the scheduler.


[ 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