Quality RTOS & Embedded Software

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


some questions on co-routine

Posted by choren lin on August 6, 2008
My version is v4.2.1,
1. What are the differences between a co-routine and a task?
What is the meaning that a co-routine really is?
I know an app can include several tasks or several co-routines, or the mixture. But how to decide that when to use a co-routine rather than a task?

2. Is it right that a task can not be access to a queue created by a co-routine? Or, a co-routine can not be access to a queue created by a task.
I think that it is right because there is not a serial of routines to implement it in FreeRTOS. Beside, if a task can be

access to a co-routine queue. It is possible that the co-routine queue will suspends the task, if that happens, then how to
order the event list in the queue? The result is that the queue can not order the task from co-routines, because the priority of the task is essentially different from that of a co-routine.
Is my understanding right?

3. Does a co-routine 'that run by the idle_task_hook' use the stack of idle task?
I think it does. Because a co-routine can be treated as a part of idle task, and it just is a normal subroutine in the body of idle task.

4. A high priority task interrupts the running co-routine, then the task finishes and the idle task gets the CPU again. Will

the idle task run at the interrupted point within the co-routine? And will the registers resume?
I think it will. Because co-routine is just a part of idle task.

5. Will the content resume , when a co-routine previously suspened itself but now it is running again?
I think the content can not resume, and the registers maybe change. Because the implement of a co-routine suspending itself is different from that of a task, a co-routine suspends itself just exit from a 'for(;;)' loop. When the co-routine is entered again, it will start to run from the top, not the suspended point.
Is that above right?

Expecting for your answer!

[ 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