Quality RTOS & Embedded Software

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




Loading

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?

Thanks.


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?

Thanks.


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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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