Can I "hibernate" a program?
Solution 1:
There's a related question about this over at StackOverflow. It's more programming related, but the main accepted answer explains why what you're trying to do is hard, and offers a viable alternative.
Basically, run your 'business' apps in a VM, and pause/hibernate/close it when you want to game.
Solution 2:
While this is not an actual hibernate, the process can be suspended. It will immediately stop using CPU cycles, but is still will be using memory. Fortunately, this memory will be swapped to pagefile, if you launch any memory-intensive application afterwards, so it's not a real issue. Suspended process can't survive reboot\logoff, but this will be enough to play a game.
Related question: Suspend/Resume a process the easy way?
Internally, process suspending could be done via different approaches:
SuspendThread and ResumeThread function pair.
NtSuspendProcess
function (not officially documented) that has been introduced with Windows XP Sp0 and works on every single system version since then.Debugging Interface provided by Microsoft, using DebugActiveProcess and DebugActiveProcessStop functions. When a debugger attaches itself to a remote process, all the target’s threads immediately get suspended till the debugger gives a sign to let them execute.
There is a number of tools available, that can suspend a processes:
- Process Monitor
- PsSuspend
- NtSuspendProcess
Moreover, Resource Monitor(Task Manager → Performance → Open Resource Monitor) in windows Vista and higher can suspend\resume processes: