none
Persist (hibernate!) a process state to disk for quiker loading

    Question

  • Is there any straight forward way to Persist (hibernate!) a process state (C++/C# window exe) to disk so that it can be quickly loaded later when required?

    Thanks

    ~ Pervez

    Wednesday, March 28, 2012 2:27 PM

All replies

  • One way would be to make EVERYTHING in your software serializable:

    http://msdn.microsoft.com/en-us/library/ms233843.aspx

    (and I like) http://msdn.microsoft.com/en-us/library/ms733127.aspx

    Then you can dump and load the objects with relative ease...I don't think there is a mechanism like hibernate though.

    Wednesday, March 28, 2012 2:41 PM
  • Thanks Hat. Our legacy app is C++ only, though it has some C# modules as well. But most of the modules are in C++ only. Above approach will not work for such apps, right?

    Wednesday, March 28, 2012 2:55 PM
  • Oh sorry, I mixed up the forums. You are right...there is no native C++ serialize (there is in C++/CLI though), you'd have to write such a mechanism yourself. If you can change the legacy app, than you could implement your own serializeable interface (a "ToXML" function would work nicely) BUT it would probably end up being a ton of work.

    If you are using C# wrappers around your C++ code, you could still implement the serialize attribute on the wrapper classes, but this would probably be hard to get a non-shallow implementation...

    Wednesday, March 28, 2012 3:09 PM
  • Thanks Pavel for the update. Can you please explain more on how this swap works so that process state will be saved in disk and reuse when required? Prefetch feature was already enabled in my system, but still application loading takes time.
    Wednesday, March 28, 2012 4:41 PM
  • Thanks Pavel for the reply. My question was more around code point of view - How to persist the process state of a big legacy c++ app to disk while closing it for quicker loading..?
    Thursday, March 29, 2012 5:30 AM
  • I don't think you can persist process information. In .NET the data in class can be serialization and de-serialization. As Pavel said, this is system function, you can not control it using codes. 

    NEU_ShieldEdge

    Friday, March 30, 2012 5:35 AM