State Save

Body: 

Additional methods should be added to all applications which would act to save the current state of each application. All relevant information including (for example) current document edits, window positions and data stream positions should be saved in a standardised way. This would enable easy save, hibernate and start functionality.

Details

Single Application

Each application should have the ability to save its state at any instant to a predefined file. This snapshot style file could be used during application startup to restore the previous session's state in a standardised manner. More importantly it would allow more useful coordinated loading/saving algorithms (See Global State).

Information saved would include items such as:

  • Data stream information
  • Window locations, sizes
  • Widget states, contained data

Triggering the save could be achieved through additional hooks in BApplication. Return codes would indicate the level of success.

Global State

There is the possibility for state saves to be triggered automatically by the operating system at certain points, including:

  • Shutdown
  • Log off

Additionally sets of applications, sessions, could be loaded at points such as system startup. Interesting sets of applications include:

  • Those running at last shutdown
  • Predefined work modes
    • 'At Work'
    • 'At Home'
  • Special constant set for startup

Using the 'previous shutdown' session we would automatically have a hibernate option. Note that there should be a mechanism to bypass the state save and, for example, have a 'real shutdown' command (potentially in a hidden place like CTRL-ALT-DEL).

Security / Stability

State files require extra attention from security perspective. They allow an extra entry mechanism for malware, virii and other dubious software. It would be a convenient mechanism for such software to load each boot.

Care must be taken to save a valid and usable state each time. If a system critical application saved an invalid state, or a state in which a crash is inevitable, the state becomes unusable. Supposing this application is set to automatically load from the state the system would require a mechanism for a 'clean' boot or 'clean' loading of applications (This was evident in OS/2 with the saving of unstable system states causing continual rebooting).

Issues

  • Some things such as streaming data are once only occurrences. How do we save state there?

Related