[Stackless] Video on channels
arnarbi at gmail.com
Mon Sep 10 17:29:19 CEST 2007
On 9/10/07, olsongt at verizon.net <olsongt at verizon.net> wrote:
> To answer Johan's question, the stack won't grow with the stackless
> version because tasklets end up going onto the heap. [That's why they
> call it stackless ;-) ] Yes, you will consume more memory as you track
> down more primes, but you'd also consume memory with the naive
> implementation where you just keep all existing primes in an array. I
> suppose if you're really concerned about memory consumption, each
> tasklet does consume more memory than each integer in an array would.
To add to that; the point of this exercise is not to find a more
efficient and/or faster way to do things. Rather, it's an attempt to
use a different mindset for programming and to think about programming
within a different model that most of us are used to. Once you
understand the prime sieve, it's actually more simple (and therefore
more beautiful) than the "normal" imperative way of using arrays.
The gain is that the CSP+channels model lends itself quite nicely to
concurrency in areas where the imperative (hope I'm using the correct
word here) does not.
More information about the Stackless