Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How could I copy the RAM of a running application, save it, and reload it into RAM later on?

I play modded Minecraft a fair bit. One downside to that is it takes a lot of time for all the mods to compile whenever I launch Minecraft. It can take around 15 minutes or so, which is too much time in my opinion. When a computer is running applications, everything it does is based off of inputs and data in RAM. I'm fairly certain that if one was to copy the RAM of their computer at a point in time and put that data back into RAM at another time, the computer would return to its former state. Though things may break down if the data in RAM doesn't actually agree with the data on the hard drive(like if windows explorer was open in the loaded RAM and showed files and folders which may not really be there on the hard drive).

I think it might be possible to copy the RAM data of an application(in my case a few GB of RAM after everything compiles and loads). I also think that if it were to be inserted back into the RAM at a later time, the application would appear already loaded without waiting for code to compile. How would I go about doing this? I think it's similar to save-state loading in emulators.

like image 382
Laff70 Avatar asked Apr 01 '20 20:04

Laff70


People also ask

How to copy code to ram at program startup?

The IAR tools can help you copy all or most of the code to RAM at program startup. Enable copying to RAM, by editing the .icf file. Create and place a second vector table in RAM, by editing the low-level source code. Set VTOR to point to the vector table in RAM, by editing the application source code.

What to do if my application is not in RAM?

If your application is not sufficiently placed in RAM as a result, read the suggestions below. The IAR tools can help you copy all or most of the code to RAM at program startup. Enable copying to RAM, by editing the .icf file.

How do I run all code from Ram in a project?

Make a copy of the .icf file that the project uses. Choose Project>Options>Linker>Config and specify that the copy you just made be used instead of the default file. Make the change described in the section Running all code from RAM: Make these changes to the .icf file: Adjust the start of the RAM region so that the RAM vector table fits:

What command do you type to save the configuration stored in RAM?

What command do you type to save the configuration stored in RAM to NVRAM? To copy the running-config to NVRAM so that it will be used if the router is restarted, use the copy running-config startup-config command ( copy run start for short).


1 Answers

I'm fairly certain that if one was to copy the RAM of their computer at a point in time and put that data back into RAM at another time, the computer would return to its former state.

This is very perceptive of you; and this is precisely what happens when a computer "hibernates" [1]. You are also correct that unless the total state of RAM is saved and restored, or if the computer is allowed to operate in between the store and the restore, odd things are very likely to happen.

It is conceivable to store / restore the RAM state for a single application, but this would be a complex operation, and even with 25+ years of a career in IT, I have not heard of an application that can do this.

... Except for Phil Brubaker's comment, which mentions virtual machines. If you run Minecraft inside a virtual machine running on your physical machine, you can do just as Phil mentions : store and restore the running state of the VM at any point -- say, at the end of a Minecraft session. 'Snapshots' (again, as Phil mentions) are how this is done.

(VM applications might offer a 'suspend' feature, and while this might in some details be different from that VM application's 'snapshot' feature, the effect is the same, and it's just like hibernation for a physical machine : the running state (i.e., the contents of RAM and some details of what the CPU is doing at that exact moment) are saved to disk, and can be restored later to bring the VM back to exactly where it was at the point it was snapshot-ed / suspended.)

So I'd recommend a web search for "virtual machine applications for [fill in your operating system here]". VMWare and VirtualBox will be top hits; there will be others, depending on your operating system and such.

[1] Note that "sleeping" is different: in sleep, only some components are shut down, such as the hard drive, which is normally always spinning, whether or not it's actually reading/writing data. So sleep is a partial shutdown to save energy. Hibernation is a longer-term, very low power mode.

like image 170
landru27 Avatar answered Oct 02 '22 04:10

landru27