Can you freeze a C/C++ process and continue it on a different host?

前端 未结 9 1251
栀梦
栀梦 2021-02-14 02:11

I was wondering if it is possible to generate a \"core\" file, copy if to another machine and then continue execution of the a core file on that machine?

I have seen the

相关标签:
9条回答
  • 2021-02-14 02:45

    Depends on the machine. It's very doable in a very small embedded system, for instance. I think it's also implemented somewhat in Beowulf clusters and other supercomputeresque apps.

    0 讨论(0)
  • 2021-02-14 02:47

    it's called process migration.

    mosix and OpenMosix used to be able to do that. nowadays it's easiest to migrate a whole VM.

    0 讨论(0)
  • 2021-02-14 02:56

    There are lots of reasons you can't do what you want very easily. For example, when you restore the core file on the other machine how do you resolve file descriptors that you process had open? What about sockets, named pipes, semaphores, or any other OS-level resource? Basically unless your system is specifically designed to handle such an operation you can't naively dump a core file and move it to another machine.

    0 讨论(0)
  • 2021-02-14 03:00

    Also checkout out the Condor project. Condor can do that with parallel jobs as well. Condor also include monitors that can automatically migrate your process when some, for example, starts using their workstation again. It's really designed for utilizing spare cycles in networked environments.

    0 讨论(0)
  • 2021-02-14 03:00

    In some cases, this can be done. For example, part of the Emacs build process is to load up all the Lisp libraries and then dump the memory image on disk for quick loading. Some other language interpreters do that too (I'm thinking of Lisp and Scheme implementations, mostly). However, they're specially designed for that kind of use, so I don't know what special things they have to do to allow that to work.

    I think this would be very hard to do for a random program, but if you wrote a framework where all objects supported serialisation/deserialisation, you can then serialise all objects used by your program, and then ship that elsewhere, and deserialise them at the other end.

    The other people's answers about virtualisation are on the spot, too.

    0 讨论(0)
  • 2021-02-14 03:07

    As of Feb. 2017, there's a fairly stable and mature tool, called CRIU that depends on updates to the Linux Kernel made in version 3.11 (as this was done in Sep. 2013, most modern distros should have those incorporated into their kernel versions).

    It can be installed via aptitude by simply calling sudo apt-get install criu.

    Instructions on how to use it.

    0 讨论(0)
提交回复
热议问题