Quality RTOS & Embedded Software

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




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 ]    [ Sitemap ]    [ ]




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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