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.
E-mail Print r 5   · Read More · 16 Comment(s)
Thread beginning with comment 344179
To read all comments associated with this story, please click here.
Wondering where this will be useful...
by kajaman on Sun 18th Jan 2009 12:32 UTC
kajaman
Member since:
2006-01-06

and my first guess are embedded systems on top of Linux kernel? I mean - come on, ordinary threads are lightweight enough for modern hardware. But threads on my phone definitely coud be lighter ;) .

Reply Score: 1

joshv Member since:
2006-03-18

and my first guess are embedded systems on top of Linux kernel? I mean - come on, ordinary threads are lightweight enough for modern hardware. But threads on my phone definitely coud be lighter ;) .


Meh. Android runs tons of threads, inside a JVM no less, on a pretty constrained hardware environment, and it all seems pretty snappy.

Reply Parent Score: 2

vivainio Member since:
2008-12-26

and my first guess are embedded systems on top of Linux kernel? I mean - come on, ordinary threads are lightweight enough for modern hardware. But threads on my phone definitely coud be lighter ;) .


Ordinary threads are pretty heavyweight, if there are thousands of them. E.g. think of running a simulation of 10000 objects, each object in its own thread. That would hog up the kernel pretty badly - while having all threads within one kernel thread neatly compartmentalizes the scheduling to that one thread.

Of course this is not a case where you would typically use threads, but at least it's possible. Though the applications are more ofter of scientific rather than practical interest.

Reply Parent Score: 1

PlatformAgnostic Member since:
2006-01-02

Threads which are blocked should not consume any computational reasources... only memory, so if you use threads only as a means of specifying your algorithm and you don't have too many running concurrently, 10,000 threads should only increase your memory footprint and startup time without affecting runtime performance.

Reply Parent Score: 2

flanque Member since:
2005-12-15

Yeah well I'd use them just so I can say I use "proto threads". The name is pretty elite.

Reply Parent Score: 6