[<<][tinyscheme][>>][..]
Mon Aug 3 19:04:49 CEST 2009

getcontext()

It doesn't seem to work in uClibc for the arm:

/home/tom/git/tinyscheme/scheme.c:4821: warning: warning: getcontext is not implemented and will always fail

So.. do I want this bad enough to figure out how to fix it?  It
doesn't look like its really difficult though, with inspiration from
pthrlib[1].  And then there is GNU pth[2], which seems to be
specifically designed to solve this issue.  Let's see what the
author has to say[3].

  * Multithreading is advantageous mostly from a resource use point of
    view.  (ED: No intermediate data structures to store, and no code
    that unfolds/folds them.)

  * Internal communication can leverage the shared address space.
    Essentially: pointers to long-lived data can be passed which might
    reduce communication overhead.

This looks contradictory at first (avoid data and then be happy you
can still pass data) but the key observation is that _intermediate
data_ is kept short-lived.  Practically this means that it will not
leave the CPU cache.

The portable trick used is creating a signal stack and jumping into it
by generating a signal.  Once there, setjmp and longjmp can be used to
save and restore context.

This all gives me the creeps..

Anyways, I can use the interface.  If performance is bad it's always
possible to replace it with a simple custom-made solution.  Like the
paper says: it's only saving a couple of registers.


[1] http://www.annexia.org/freeware/pthrlib
[2] http://www.gnu.org/software/pth/
[3] http://www.gnu.org/software/pth/rse-pmt.ps

[Reply][About]
[<<][tinyscheme][>>][..]