Concurrency Proposal

Tony Garnock-Jones tonyg at lshift.net
Tue Mar 14 11:15:58 PST 2006


Levi Pearson wrote:
> Can you give me some references to where this userland state is? I
> don't remember seeing the current support for switching threads, so a
> reference to that would be helpful too.

Take a look at the condition-stack manipulation in src/lib/process.slate
(which implements the core of the nonpreemptive threading already present).

> I really wish there was a better way to get pinged periodically by the
> OS.  Polling via a context switch to kernel space at frequent
> intervals seems pretty evil, too, but if you guys prefer that to the
> possibility of future signal collisions with libraries, I'll plan on
> doing it that way.

I thought of an even more evil way just now, which may even be
practical: allocate some shm, fork, and in the child, repeatedly touch
the shm and sleep for a few milliseconds. In the parent, check the shm
just like a normal memory access, on the occasional backward branch.

Fast; effective; disgusting :-)

Tony



More information about the Slate mailing list