Homepage | FAQ


This is a subsection of the full FAQ

Can a context switch occur within an ISR?
How do I write an RTOS safe ISR?
Can interrupts be nested?


Can a context switch occur within an ISR?

Yes. Each RTOS port provides a macro to request a context switch from within an ISR. The name of the macro is dependent on the port (for historic reasons). It will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR. Refer to the documentation page for the port being used.

Every official port comes with a demo application that demonstrates context switching from an ISR.

How do I write an RTOS safe ISR?

That is very dependent on the microcontroller and tool chain port of FreeRTOS being used. Refere to the documentation page and demo application for the RTOS port being used.

Can interrupts be nested?

It depends on the port. See the description of the configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY configuration parameters for additional information.

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.

New Updates to MIT licensed IoT MQTT and POSIX libraries are now available. New library IoT HTTPS is available.  Includes demo projects.

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
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