Search code examples
cprocessoperating-systemkernelxv6

Executing a Stopped Process in XV6


I wrote two new system calls and add them to the xv6 OS kernel. So using one system call I can save process state and using the other one I can reload the previous state and continue. the problem is in the reloading section.


is it enough to reload just the context of the process ? (i mean the struct context which contains some CPU register)


Solution

  • No.

    The process may have open files and pipes in proc->ofile, which you need to save/load.

    Note also that by the time you re-load a process, its parent may no longer exist.
    You'll really want to make sure your process isn't floating around without a real parent, or you'll be in for some fun bugs.