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


taskYIELD and task slot length optimization

Posted by alsaleem on April 10, 2017

I have several tasks of same priority. Each time slot is 10msec (ticks is 100Hz).

If a task needs only 6msec (of 10msec). I would like to give rest of time to other tasks instead of waiting next tick (assuming no active high priority task take over on next tick).

As per the maual, taskYIELD will cause OS to switch to other tasks. The next task will only have 4msec of work before next context switch because of SysTick.

Assuming above is correct, (1) Is there a way to make OS not to context switch on next tick?

(2) If a high priority task wants to allow lower priority tasks to do some work until next tick, will vTaskDelayUntil(&var, 1) block running task immediately and allow lower priority tasks do work until next tick?


taskYIELD and task slot length optimization

Posted by richard_damon on April 10, 2017

1) If you disable Time Slicing then tasks of the same priority will not rotate on ticks, but only when yeilding or blocking. 2) If you have Preemption enabled, then the higher priority task will startup as soon as it is ready (which if it is doing a delay, will be on the timer tick).

One note, if you really want to delay till the next timer tick, use vTaskDelay(1), vTaskDelayUntil(&var, 1) will only delay if the task has 'caught up' to the tick counter.

taskYIELD and task slot length optimization

Posted by alsaleem on April 10, 2017

for (1) I am working on preemption. Assuming no higher priority tasks.

So, will taskYIELD allow next (same priority) task to run until next tick or for whole time slice?


taskYIELD and task slot length optimization

Posted by rtel on April 10, 2017

Until the next tick.

taskYIELD and task slot length optimization

Posted by alsaleem on April 11, 2017

thanks. that is short and clear answer.

[ 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