开发者

How can I "Hibernate" an application?

开发者 https://www.devze.com 2023-01-24 07:38 出处:网络
Say I have a complex application that does various things, e.g. brings up a window, loads some assets, processes a virtual world, goes into OpenGL, etc.

Say I have a complex application that does various things, e.g. brings up a window, loads some assets, processes a virtual world, goes into OpenGL, etc.

Can I hibernate it, i.e. save its current memory state and resume it later at will in a safe manner?

If to be safe it would have to restrict the user from some func开发者_开发百科tionality 'till it's resumed it's fine.


This really depends on what hibernation is for you. If this should be a feature across a reboot of your machine and your program is sufficiently complex look into a virtual machine as a container of your program. Then use the hibernation feature of the guest operating system.

If this is not what you want and you don't care about saving the state across boots, just stop your program. In linux e.g you could then evacuate all the memory your program needs to swap. (I guess this should be possible on other OS', too)


See How to "hibernate" a process in Linux by storing its memory to disk and restoring it later? for linux-specific version of your question (and answers!)


If you can save/resume games, why not business applications? You just have to make a process to write the app state to disc... then load that state from disc - Making sure that nothing is different between before and after.

How complicated that is really depends on a lot of things - remote connections, db states, multi-user environments, etc...

0

精彩评论

暂无评论...
验证码 换一张
取 消