Linked by Thom Holwerda on Sun 18th Jan 2009 11:16 UTC, submitted by anonymous
General Unix 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.
Thread beginning with comment 344441
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Small embedded systems
by LMRuane on Tue 20th Jan 2009 00:58 UTC in reply to "Small embedded systems"
Member since:

I published a new version of protothreads you may be interested in, linked from the wikipedia page, and also now on Google Code:

We (I work for HP) use it on a system that's much bigger that a small embedded system (a storage appliance running Linux with many GB of memory), and the reason is, as you said, the programming is simpler than event-driven. It has the same performance as event-driven code, and much faster than regular threads (at least the Linux POSIX pthread library). I measured context switch performance to be 135 times as fast, and thread create - destroy to be 643 times as fast.

You are right that protothreads (including my version) can't take advantage of multiple-CPUs.

Another very important advantage of protothreads (over POSIX threads)for us is that we can write deterministic pseudo-random system-level tests that are reproduceable. (The documentation discusses that a little.)

Reply Parent Score: 1