Save a process' memory for later use?

前端 未结 8 1698
温柔的废话
温柔的废话 2020-12-14 00:28

Is it possible to pause a process, save the memory contents to a file, and then later reload the file so you can continue the program?

Edit I\'ve be

8条回答
  •  北海茫月
    2020-12-14 01:24

    Depending on your requirements and OS you could try forcing a core dump

    I have never tried actually loading a core dumped program back up other than in gdb. It seems like any files you have open or any other state that is not in your programs memory would be lost as sharptooth pointed out.

    Another approach would be simply serializing the state you need to disk in your program. It sucks but it is probably the most reliable way unless you are content with suspending execution of the program. That could be done with your operating system's thread library. Or as one poster pointed out with your shell.

提交回复
热议问题