Quality RTOS & Embedded Software

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


xMissedYield vs. xPendingReadyList?

Posted by Igor Polevoy on July 23, 2008
when the scheduler is suspended the FreeRTOS code in e.g.
vTaskResume places the task in the ready list, and if the taskYield is required
it (probably) relies on the vTaskSwitchContext that will just raise xMissedYield
flag for the scheduler when it resumes.

However xTaskResumFromISR uses a different approach and moves readied
task to a separate xPendingReadyList. I don't quite understand why the same code as in vTaskResume is not used here?
IMHO it shouldn't has problems with critical section (the comment in the vTaskResume code says : As we are in a critical section we can access the ready lists even if the scheduler is suspended.) since the xTaskResumFromISR is supposed to be called form an ISR with all apropriate context saved before?

RE: xMissedYield vs. xPendingReadyList?

Posted by Richard on July 23, 2008
When the scheduler is suspended interrupts can still execute so there has to be some mutual exclusion on the scheduler controlled data structures. The rule is that tasks can access the structures but interrupts cannot - so there is only one thing trying to access the structures at any one time. Interrupt cannot access the ready lists directly, so instead add readied tasks to the pending ready list from where they will be moved into their appropriate ready list when the scheduler is resumed.


RE: xMissedYield vs. xPendingReadyList?

Posted by Igor Polevoy on July 23, 2008
But interrupts can happen also when the scheduler is not suspened. Why then the task is directly added to the ready queue?
And I saw that all accesses to the scheduler structures are protected by the
taskENTER/EXIT_CRITICAL in the task.c - so it should already guard against data corruptions by an ISR.
Are you saying that only in suspended mode there is an unprotected access to the scheduler data structures in the code?

Thank you again,

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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

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

Cadence Tensilica Cortes

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