Protothreads

From Contiki
Jump to: navigation, search

Back to Contiki Tutorials

Description

Protothreads are extremely lightweight stackless threads designed for severely memory constrained systems, such as small embedded systems or wireless sensor network nodes. The advantage here is that they do not waste memory on multiple stacks that are only partially used. They provide sequential execution without the need for large state machines or multithreading. Perhaps the most significant advantage is that they provide conditional blocking inside a process event-handler. Without protothreads, if an event handler did not return, other processes would not be scheduled. Protothreads, on the other hand, allow block operations within the event-handler. As a result, there is less application code, more blocking operations, and event infinite loops.

Implementation

Edited by: Rahul