Quality RTOS & Embedded Software

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


Context switching outside of ticks..

Posted by lukeiy on September 9, 2016


When a task blocks because a semaphore isn't available to take, does the context immediately switch to another task? Or does the OS pend until the next systick after which a context switch occurs?

I need to sample something at 1000 hz, but my systick is also at 1000 hz. I'm worried that my sampling task will starve all other tasks of processing time.

Thanks in advance.

Context switching outside of ticks..

Posted by rtel on September 9, 2016

FreeRTOS, by default, uses a prioritised pre-emptive scheduler. It will always run the highest priority task that is able to run.

If a task enters the Blocked state (because it is waiting for an event, be that a message on a queue, or a direct to task notification, or whatever) the scheduler will immediately select another task.

If a task sends an event to a higher priority task that causes the higher priority task to exit the Blocked state, then the scheduler will immediately switch to the unblocked task.

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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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