title: How to write virtual machine?
body: <p>I see very simple simple-virtual-machine-C on github. But it seems to be too simple. It interpret bytecodes in loop. How running supervised code , especially multithreaded? I think, for supervisor - supervised code, maybe use debugger - debuggee, main advantage: debugger can stop all threads, it needed to run garbage collector; disadvantage - how alloc and release memory for supervised process? Supervised can use vmalloc?</p>
  <p>Second solution - one supervisor process, which execute supervised code. It is possible load machine opcodes to heap and run function from heap segment instead of code segment? Other solution - loading bytecode instead machine code and translate it to X86, it will complicated, is possible use LLVM IR to x86 translation in this case? How work LLVM JIT? Is any simple example for running (instead interpret) code in VM environment?</p>