Results 1 to 10 of 10
-
2020-05-12, 12:33 AM (ISO 8601)
- Join Date
- Feb 2016
Is there any way to "snapshot" a running program/process to disk?
Is there any way to save the complete state of a running computer program so that it can be resumed directly to that state directly at a later time or restored to an earlier state? Something akin to hibernation mode but just for a single program and without necessarily suspending the program, just saving its state in case it needs to be restored to an earlier state?
Likely this would be mediated by a second program but I dont know what that program would be?"If you want to understand biology don't think about vibrant throbbing gels and oozes, think about information technology" -Richard Dawkins
Omegaupdate Forum
WoTC Forums Archive + Indexing Projext
PostImage, a free and sensible alternative to Photobucket
Temple+ Modding Project for Atari's Temple of Elemental Evil
Morrus' RPG Forum (EN World v2)
-
2020-05-12, 12:54 AM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: Is there any way to "snapshot" a running program/process to disk?
Well, no, because the complete state of a running program on any multitasking OS also requires the state of all the other programs on there, because it might be in the middle of an interaction with them or with the OS itself.
-
2020-05-12, 06:01 AM (ISO 8601)
- Join Date
- Mar 2012
- Location
- UK
- Gender
Re: Is there any way to "snapshot" a running program/process to disk?
For suspending a process/application:
If you are running the process on a virtual machine or emulator then there is a chance that you may be able to suspend the vm/emulator and save its state.
This would enable you to restart the vm or emulator at the paused point, with the process still running.
Similarly, it is not beyond the bounds of possibility that there are code interpreters out there that will do the same thing for a program under execution (just very unlikely because of interactions with other objects).
As you may notice, the key point in all the above is that the ability to suspend processing is a property of where you are running the process, not the process itself.
The reason why factotum gave a straight "no" an answer is because doing so inside an OS would be incredibly dangerous. Suppose the process being halted is currently writing to the second monitor; what happens if there is no second monitor when the process is resumed? Repeat this question for every single component of the machine (e.g. graphics card) and you can see why you cannot just pause a process.
I think some virtual machine deployments allow a VM to be paused this way, but I suspect that won't provide what you want as it pauses the entire (virtual) machine not just one process.
If you want to be able to restore the process/application to an earlier configuration, then either it needs to be written to enable you to do this (so that it can export and import configuration sets), or you need to be backing up and recovering the configuration of the program externally - don't even consider trying this while the program is running.
-
2020-05-12, 10:31 AM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: Is there any way to "snapshot" a running program/process to disk?
Even in the case of virtual machines they don't often provide a complete "turn off and revert to where you were" system unless they're emulating an old machine or OS--e.g. DOSBox and WinUAE will do it, but I'm pretty sure VirtualBox will not. (It allows you to take snapshots while the machine is running to save the current state of it, but you can't actually restore the snapshot while the machine is active).
-
2020-05-12, 11:38 AM (ISO 8601)
- Join Date
- Jan 2009
Re: Is there any way to "snapshot" a running program/process to disk?
This is probably not really what you want, but if it is a programming language program you are running, you might be able to do something similar to this by saving a snapshot of all the data you are manipulating at a given moment. You could probably write a subroutine that saves all the relevant data points to some external file, as well as a marker to let you know where in the program it last saved. If you had to pause/stop execution of the program, you could come back to it later and run a small "loading" program to load all the saved data, then just run the remaining section of code.
I don't think that would work well if it's code that is compiling some executable file (though maybe it could), but I could see this in something like SQL data manipulation--essentially saving a copy of all the tables you're working with and reload the working copies. But, depending on workload, that'd probably be an incredibly expensive method, in terms of save/load time and memory, and not worth the time unless it's a really important debugging step.
But, like I said, I figure you're thinking of something rather different. This really just saves the memory/data elements the program is working with at the moment.
-
2020-05-12, 01:29 PM (ISO 8601)
- Join Date
- Mar 2005
- Location
- 61.2° N, 149.9° W
- Gender
Re: Is there any way to "snapshot" a running program/process to disk?
If its an already existing program your best bet will be virtual machines and doing a pause-clone-restart of the machine. It is sometimes possible, although not often recommended or supported, to share hdd space between the physical and virtual machines. Perhaps better is that you can often, and is usually supported, set up a virtual network between vms or vm and physical.
If the program is in development or you have source code to modify then you're looking at saving your whole memory stack, at least all the important bits. That's just an in depth save function. The biggest issue will be setting the program up to save and restore everything. That may hurt.Last edited by Telok; 2020-05-12 at 01:29 PM.
-
2020-05-13, 07:45 PM (ISO 8601)
- Join Date
- Nov 2010
- Location
- California
- Gender
Re: Is there any way to "snapshot" a running program/process to disk?
Fun fact -- the original Colossal Cave Adventure "saved" by using a PDP-10 feature that snapshotted and then restored the entire running state of a problem.
The PDP-10 was probably about the last architecture/OS that supported this feature, though.
-
2020-05-20, 03:02 AM (ISO 8601)
- Join Date
- Jul 2008
- Location
- Sweden
- Gender
Re: Is there any way to "snapshot" a running program/process to disk?
As many have said VMs let you do this, in particular Docker has this feature explicitly. You can pause/start/restart, create checkpoints, save checkpoints as image files and start/restart from checkpoints.
Generally if you want to use programs in a sandbox-y mode with hibernation and whatever then using virtual machine is your best option. The operating system inside the VM can also be tailored/picked specifically for this program.Black text is for sarcasm, also sincerity. You'll just have to read between the lines and infer from context like an animal
-
2020-05-21, 08:21 PM (ISO 8601)
- Join Date
- Aug 2009
Re: Is there any way to "snapshot" a running program/process to disk?
-
2020-05-22, 12:21 AM (ISO 8601)
- Join Date
- Feb 2007
- Location
- Manchester, UK
- Gender
Re: Is there any way to "snapshot" a running program/process to disk?
A snapshot is designed to allow you to return the machine to a known state--for instance, if you're about to install something that you think might break the installed OS, you take a snapshot, then, if your worst fears are realised, you can revert to the snapshot and all will be well. Can be useful when testing the installer for an application you've written, too.