Quality RTOS & Embedded Software

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


Loading

Context switching in cooperative mode

Posted by Nobody/Anonymous on May 31, 2005
Hello,

Do calls to cQueueSend, cQueueReceive cause a context switch when FreeRTOS is running in cooperative mode, or is an explicit call to vPortYield() in the task code required to do this. The reason I ask is because calls to taskYIELD() appear in the cQueueSend(), cQueueReceive() functions, but I don't know if these will be called when in cooperative mode.

Thanks
Khusro

RE: Context switching in cooperative mode

Posted by Nobody/Anonymous on May 31, 2005
Calling these functions will implicitly call Yield, as you say. A switch will occur if the call unblocks a task that has higher priority than the calling task.

You could modify the code to prevent this if you wanted - I think you would need to ensure that the function xTaskResumeAll() in tasks.c (or cTaskResumeAll() depending on your version) always returns false if the cooperative scheme was being used. Also remove the yield from within the xTaskResumeAll function itself.

To test for the cooperative scheme you can use #if configUSE_PREEMPTION == 1

Or you could design the tasks and priorities such that a yield will have no effect.

The cooperative scheme just prevents the tick causing a switch. The application then has control by either calling yield or an api function that will cause a yield.

Hope this helps.


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


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

Latest News

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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 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.


Careers

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

Renesas

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