Modified protothreads for embedded systems

Protothreads are stackless lightweight threads that provide a mechanism for concurrent programming with very low overhead in any environment that supports an ANSI-C compiler. No processor-specific task switching code is required to implement them. In their published form they are not quite adequate for a priority-based based scheduler and thus are of questionable utility in an embedded system with real-time requirements. This article discusses the protothread library along with modifications and an example priority-based scheduler that may be of some utility in embedded systems environments lacking an RTOS.