Download FreeRTOS

Quality RTOS & Embedded Software

FreeRTOS website now available in Simplified Chinese
New FreeRTOS Long Term Support version now available.
FreeRTOS Extended Maintenance Program (EMP) registration now open.
FreeRTOS-Plus-TCP v3.0.0 released:
Featured FreeRTOS IoT Integrations:
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.