Search code examples
windowshibernatememoryprocessoperating-system

Hibernate an entire process in Windows


It is possible, to save an entire process to a file, in order to restore it into a memory after system reboot, causing it to return to a running state?

If a process is a set of WinAPI calls that are in binary code of an executable file, and the local variables are stored in a savable memory region, then theoretically, this should be possible.

But if a process, running on one instance of an OS is linked to system addresses (resource handles), that are a subject to change after reboot, then it is of cause can't be done.


Solution

  • Due to system state that is not a part of the process itself, Windows is unable to hibernate certain processes. For instance, mutexes can become available to other processes when a program holding one goes into hibernation, which could result in state corruption. Similar to this, when a file opened for exclusive access is hibernated, another process may alter it, resulting in an altered file when the original program resumes. Hibernation management challenges include handling of windows and messages, undeletable files, and open objects management. Developers must expressly build checkpoint functionality if they want it and take on any associated difficulties.

    For details answer take a look at

    Why can't the system hibernate just one process?