Quality RTOS & Embedded Software

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




Loading

xMissedYield vs. xPendingReadyList?

Posted by Igor Polevoy on July 23, 2008
Hello,
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.

Regards.

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,
Igor.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists