Protothreads are a type of extremely lightweight threads - each protothread requires only two bytes of memory - that are usually used for embedded firmware programming, where memory is at a premium. Protothreads combine the low overhead with event-driven programming with the algorithmic clarity of threaded programming.
Larry Ruane from LeftHand Networks Inc. has written a protothreads library for Unix systems that, unlike Adam Dunkels' original library, contains a complete scheduler that allows several protothreads to run inside a regular thread. Ruane's protothreads are implemented in less than 400 lines of C code using gcc's labels-as-values feature. The project wiki has a thorough explanation of how protothreads work and how they are intended to be used. The open source code can be downloaded from the project's SourceForge page.
Read More...
1 comment:
Thank you for posting this notice, but I would like to point out that this library is not just for UNIX. It is independent of operating system, and does not need an operating system.
The connection to UNIX is simply that I used its model for thread (process) synchronization, which I think is an excellent and simple model.
Also let me mention that I uploaded the same code to Google Code:
http://code.google.com/p/protothread/
which has an SVN server and will probably be the center of activity for this project. Over the next few days I will create a discussion group, so others can submit ideas or patches.
Larry Ruane
Post a Comment