16

Just freeze an application (suspend the CPU, save its state to disk) and 'defrost' it when I want to use it 4 weeks later.

Gilles 'SO- stop being evil'
  • 69,786
  • 21
  • 137
  • 178
William C
  • 161
  • 2
  • 6

3 Answers3

8

Many people would wish for this, including myself.
Alas, no. This operation does not exist, and cannot exist.

Think for example about freezing an application that had an open file on the CD or an open Internet connection. Now imagine what it would take to "freeze" and "unfreeze" it: All files and connections to be saved, then re-created, CD drive maybe to be verified and file opened, Internet connections to be re-established with all login info into the site, etc etc.

This is just too complex to implement in any operating system, and would also be a security hole.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • 2
    Virtual machines? That's awfully clunky though. – Shinrai Nov 26 '10 at 16:11
  • set the priority of the app to the lowest setting? this of course would not free up the used RAM – Xantec Nov 26 '10 at 16:32
  • 1
    @Xantec: This wouldn't withstand a reboot. – harrymc Nov 26 '10 at 17:12
  • @Shinrai: Good suggestion for the case where there are no CD or Internet. – harrymc Nov 26 '10 at 17:14
  • @harrymc: No, it is possible, though it's not commonplace. I've heard of Unix variants with restartable core dumps (I don't know how they work wrt file descriptors). And traditional Lisp implementations can dump memory (here it's up to the standard library to do something about open files). I suspect better facilities exist on some mainframe OSes or OSes on some embedded devices (communication equipment?). – Gilles 'SO- stop being evil' Nov 27 '10 at 00:43
  • @Gilles: Unfortunately not on Windows, and I have searched. One can force a fulldump on a running application, but .dmp files are not restartable, just usable for analyzing a crash. – harrymc Nov 27 '10 at 08:28
  • There's a program for Linux that can "hibernate" individual processes (and even resume them on different machines) - I hope it's possible to port it to Windows. http://cryopid.berlios.de/ – Anderson Green Dec 03 '12 at 19:27
  • @AndersonGreen: Alas, CryoPID also does only partial suspend/resume. – harrymc Dec 03 '12 at 19:41
  • @harrymc Why is it considered "partial"? – Anderson Green Dec 03 '12 at 19:43
  • @AndersonGreen: No support for threads, TCP will only work if the server website remembers the program, no support for removable media, X applications not supported (special compile required), and see also the brown-colored items in the list. – harrymc Dec 03 '12 at 19:48
  • 1
    then how the heck does windows even hibernate? you state it's impossible. If you can fully hibernate then partial hibernation should be just as easy – Gizmo Jun 16 '14 at 18:16
  • @Gizmo: The hibernation of Windows is also not guaranteed to work, in exactly the same cases for programs using the CD or the Internet when frozen. – harrymc Jun 16 '14 at 18:34
  • 1
    so, I if windows hibernation is able to suspend my game, I can probably suspend it as long as it doesn't use the internet, CD drive, or anything that will be unavailanle afterwards? Then how do I accomplish per-process suspension and restoration? – Gizmo Jun 16 '14 at 19:15
  • @Gizmo: You don't - nobody ever created this very complicated software which has to work from inside the operating system. Neither Microsoft nor Linux thought it justifies the effort. For gaming, create a virtual machine and install your game in it. The VM can be suspended and restarted. – harrymc Jun 16 '14 at 19:38
  • @harrymc, It wouldn't have to be complex if the OS was designed **from ground up** to have this feature in the first place. It's the monkey patching that's hard, not the feature itself. – Pacerier Nov 19 '14 at 11:58
2

While some systems do have such a technology, it takes a lot of effort on both the operating system developer's and the application developer's parts. So, in practice, consider the answer to be no. (Examples of systems where this can work are Unix variants where core dumps are restartable and Lisp implementations that have a dump facility. Even then this may behave strangely if the application has connections to the outside world such as open files.)

You can run the application in a virtual machine (e.g. Virtual PC), and hibernate (save the state of) the whole VM. You will need a suitable Windows license in the VM. If you start using VMs, expect your RAM usage to go way up (if you're running a host OS and a virtualized OS, the memory requirements add up).

Gilles 'SO- stop being evil'
  • 69,786
  • 21
  • 137
  • 178
1

Technically, yes.

You can suspend it:

Windows: Resource Monitor>Memory>Right-Click "process.exe">Suspend

Linux: "kill -[STOP/CONT] [PID]"

But it will remain in RAM, even if it isn't using CPU power.

Therefore, you would have to either keep your computer on or set it strictly to hibernate in order to keep the process from dying. In the meantime, if your computer is configured properly (I haven't read that deep into it), it should be able to move the suspended process into your page file when it needs more physical RAM.

I know this response is late, but I came across this question while looking for the exact same thing, so I figure I can help any future adventurers find what they're looking for. Who knows? Maybe in the future they may develop the potentially AI-powered software to accomplish this.

Mok
  • 31
  • 3
  • 1
    Author isn’t using Linux. This was posted as an answer, but it does not attempt to answer the question. It should possibly be an edit, a comment, another question, or deleted altogether. – Ramhound Oct 18 '18 at 05:09
  • 1
    @Ramhound This answer provides methods for both Windows and Linux. I cannot verify whether the suggested approach for Windows works, but it certainly is in the answer. The method mentioned for Linux works (I have frequently used it myself). – kasperd Oct 18 '18 at 13:28
  • Note that unused memory will eventually be paged if needed, in order to make room for fresh data, and it will be restored from swap when resumed, so in a way, it will be offloaded when it needs to be offloaded. But not explicitly. This is the case with most functionality in windows, and as it seems, software in general. Lots of software has its own ways of suspending and resuming, but for many it is still at opened project level. – dtech Jul 26 '22 at 11:33