[Mono-devel-list] Thread Migration, Checkpointing and User Level Threading

Jim Purbrick jimpurbrick at yahoo.co.uk
Fri Apr 1 18:27:03 EST 2005

I'm currently looking in to saving and restoring
thread state, primarily to allow migration of running
threads between servers and checkpointing running
threads when servers are shut down.

I've built a prototype which implements logical thread
state saving and restoring in bytecode in a similar
way to the Java JiST, PicoThreads and JavaGo systems.
The prototype checks a flag before each method call
and, if set, packs up the method state in to an object
which is pushed on to a heap allocated stack before
returning to the caller. The caller then does the same
and so on until the entire logical stack is saved.
When methods are called they check to see if there are
any frames on the heap allocated stack and if so
restore the logical stack from the saved frames.

The current implementation runs the fibonacci
benchmark 50 times concurrently in ~34s compared to
the unaltered benchmark which runs the benchmark 50
times sequentially in ~8s. This is a worst case
scenario though as the fib method does very little
apart from calling itself recursively.

It looks like this is going to be fine for allowing
running scripts to move between servers, be saved and
loaded and scheduled within my virtual world, but I
have a couple of questions before I build a full

1) Ultimately I'd like to allow any language that
targets the CLR to be used to script the virtual
world, would I be able to inject code in to the CIL
output of any compiler to add threading support, or
could it potentially break the output of some

2) Is there any easier way to do this by extracting
the logical state from the native stack? I looked at
this for a while, but it seemed that recovering the
thread state from the stack of JIT compiled code was
non trivial.

3) Is there an easier way to do this by transfering
the native stack opaquely? What would I need to do on
the target machine to ensure that a stack saved from a
different source machine would run properly when

Thanks for all your help,



Send instant messages to your online friends http://uk.messenger.yahoo.com 

More information about the Mono-devel-list mailing list