Download FreeRTOS
 

Quality RTOS & Embedded Software

KERNEL
WHAT'S NEW
Simplifying Authenticated Cloud Connectivity for Any Device.
Designing an energy efficient and cloud-connected IoT solution with CoAP.
Introducing FreeRTOS Kernel version 11.0.0:
FreeRTOS Roadmap and Code Contribution process.
OPC-UA over TSN with FreeRTOS.

Characteristics of a 'Co-routine'

Note: Co-routines were implemented for use on very small devices, but are very rarely used in the field these days. For that reason, while there are no plans to remove co-routines from the code, there are also no plans to develop them further.

Co-routines are conceptually similar to tasks but have the following fundamental differences (elaborated further on the co-routine documentation page):

  1. Stack usage

    All the co-routines within an application share a single stack. This greatly reduces the amount of RAM required compared to a similar application written using tasks.

     

  2. Scheduling and priorities

    Co-routines use prioritised cooperative scheduling with respect to other co-routines, but can be included in an application that uses preemptive tasks.

     

  3. Macro implementation

    The co-routine implementation is provided through a set of macros.

     

  4. Restrictions on use

    The reduction in RAM usage comes at the cost of some stringent restrictions in how co-routines can be structured.

Co-Routine Summary

Sharing a stack between co-routines results in much lower RAM usage.
Cooperative operation makes re-entrancy less of an issue.
Very portable across architectures.
Fully prioritised relative to other co-routines, but can always be preempted by tasks if the two are mixed.
Lack of stack requires special consideration.
Restrictions on where API calls can be made.
Co-operative operation only amongst co-routines themselves.

 

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