Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Jeko wrote:What do you think about saving all the RAM memory in a file before the shutdown of the computer and load it in the next boot? With this method you can save the state of your computer, with all the applications running... Is it a stupid idea?
The state of the computer is not just the RAM. There's also devices that need to be taken care off.
Yep. Your devices have undergone a power cycle, and might need some setup (firmware loading etc.) so their previous state is recovered (if that is possible).
You'd also want to think about security. I consider it a really bad idea to have a computer come out of hibernation directly onto the previous user's desktop - the person waking up the computer might not be the same as the one that hibernated it. And whatever happened to any open network sessions...
Every good solution is obvious once you've found it.
Solar wrote:Yep. Your devices have undergone a power cycle, and might need some setup (firmware loading etc.) so their previous state is recovered (if that is possible).
You'd also want to think about security. I consider it a really bad idea to have a computer come out of hibernation directly onto the previous user's desktop - the person waking up the computer might not be the same as the one that hibernated it. And whatever happened to any open network sessions...
Obviously drivers need to know you just came up from hibernate, but ignoring that...
1: lock the desktop on resume, and you're solved the security problem.. you can allow multiple parallel desktop sessions like modern Windows, so you can't even claim that'll cause any problems.
2: any network connection will inevitably have to deal with losing the connection anyway, and power-cycling isn't in any way special.. in fact, with protocols like TCP, you might not even (strictly) need to make the protocol stack aware of hibernates.. it'll timeout the old connections and recover normally anyway.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Oh, I wanna add.. there are research systems like EROS that can boot into the previous state even when they lost power without anyone telling 'em in advance. The basic idea IIRC is to keep the whole state of the system transactional, and constantly save changes to disk upon IPC, such that when you lose power, you just recover the last known state kinda like a database would do.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Making the entire OS transactional is a too large overhead for a feature as this. You can assume that a user work station will not power fail without advance notice, or that if it does the user will tolerate a longer bootup time.
The scenarios I see are:
- Laptop power fail - you're informed in advance, so you can save & turn off in time
- UPS power fail - same as laptop
- Mains unplug / physical loss of power without backup - user knows that the system has been compromised in its integrity and will expect you to recover. The file system should always remain usable, but if you lose 10 seconds of work (or something) that should be quite acceptable.
A few personal opinions:
- All programs should autosave reliably & quickly enough for you to not notice.
- All programs should keep their state the same when you shut down & restart them. Firefox does this if you have 2 or more tabs (in a question - just always do it), Notepad++ always does it, Word never does it.
- The file system should take care of versioning and backups. All editing should directly edit a file; if you want to keep the current and new version, make your computer do versioning instead of "remembering to copy the file".