[M3devel] a note on user thread -- *context not 'universal'

Jay jay.krell at cornell.edu
Mon Jan 12 15:05:34 CET 2009


just a note, that make/get/set/swapcontext are not available on Darwin (10.4) and OpenBSD.I didn't check NetBSD. It is on Linux, Solaris, FreeBSD.
 
A "dual" approach where some ports use setjmp/longjmp, some use *context, probably reasonable.
 
Another approach that would probably work is you double up the jmpbuf.Always make a copy before setjmp and setjmp to the copy.That way if longjmp "scrambles" it, no matter.If you can't even copy them, well, setjmp to the "original", copy it away, and thenrecopy before any setjmp.
 
However, this is inefficient and using *context is probably better, where it is available.
 
question:
 
On Windows, you can "reserve" virtual memory, and "commit" it."reserve" is allocating just the address space."commit" I think is ensuring there is room in a pagefile.Reserve is cheaper. You can overrreserve but I guess not long-term overcommit.Usually stacks are only ever at first reserved, and then commited gradually,like a page at a time.
 
Whatever *context documentation I could find, didn't talk about this.They either used a local char array, or a called mmap.On at least some platforms, there a flag to mmap to indicate you are creating a stack.
 
 
Do we really need the assembly _fpsetjmp?
 - Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20090112/99fa3061/attachment-0001.html>


More information about the M3devel mailing list