Protothreads
Protothreads are extremely lightweight stackless threads designed for severely memory constrained systems, such as small embedded systems or wireless sensor network nodes. Event-driven programming is often considered “hard” because of the need to explicitly manage state-machines. Protothreads significantly reduce the complexity of programming memory constrained systems by making it possible to write event-driven programs in a thread-like style, with a memory overhead of only two bytes per protothread.
Read the Protothreads SenSys 2006 paper here.
Protothreads library is available for download here.


