V
V
Vadim Chernov2014-10-13 08:14:44
linux
Vadim Chernov, 2014-10-13 08:14:44

How to "freeze" a process and save its state to disk?

I think those who have used the "Save the machine state" button in Virtualbox or similar ways to hibernate a virtual machine will understand the question more clearly. Such a trick allows you to unload the entire virtual machine from memory and then restore it in such a way that not even a second will pass for the machine ... I
'm interested in the ability to do the same with only a process (or several at a time):
1. Stop the process (pause)
2 Save its state to disk (used data in RAM, file descriptors, etc.)
3. Unload the process
4. After some time, load all this data back into memory and unpause the process
A similar trick is done by the hibernation mode in modern operating systems, but it again saves the state of the entire system, and even turns off the power.
If there are any boxed versions (programs), pieces of code in any languages, knowledge about suitable functions in the OS kernel - please write here!
It is desirable for Linux, but I will not refuse Windows solutions either ... Mac OS will not be useful to me, but maybe someone will need it :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Deerenaros, 2014-10-13
@Xatory

One two three
UPD.
I re-read the question and it is worth adding that shindos does not allow such luxury. That is, with reservations, but here my remark @begemot_sun is nowhere more relevant - too expensive.

S
Sergey, 2014-10-13
@begemot_sun

Impossible.
Why?
1. In the case of a Wirth machine, you save its entire state, including the state of the Wirth periphery, etc. those. there is no global state for a virt machine that cannot be saved.
2. In the case of hibernation, everything is the same, the system itself retains its state + the state of the processes, i.e. again, there is no global state that is not saved (peripherals also do not need to be saved, because the OS itself initializes it at the time of start
3. In the case of one process, we have not only the state of the process, but also all sorts of OS descriptors that the process uses , interacting both with the OS and with other processes.They will not be saved, because at the time of awakening such a process, the state of the OS and other processes will be irreversibly changed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question