Omnimaga
Calculator Community => Discontinued => Major Community Projects => KnightOS => Topic started by: SirCmpwn on March 02, 2011, 10:16:38 pm
-
So here's what I think I can do with KOS to hibernate:
1. User requests hibernation
2. The kernel takes control, shuts down multithreading and kills interrupts. It is now the only running process. Because it halts interrupts, all threads are suspended in their current state.
3. The kernel creates a file: /tmp/hibernation.data (filesystem is in ROM)
4. In this file, it dumps all RAM (which contains executing programs, each program's stack, the thread table, allocated memory... everything that makes KOS tick)
5. Then, it turns off the calculator.
*some time later
6. The user turns on the calculator.
7. During boot, the kernel sees that /tmp/hibernation.data exists, and loads the contents into RAM (remember that at this point, multithreading has not been initialized, or memory management)
8. The kernel deletes /tmp/hibernation.data and skips most of the initialization process.
9. Simply enable interrupts, and you're right back to the state you left it off from!
-
Seems good to me. SOmetimes it's good to not have to wait 2 minutes for an OS to boot everytime you want to use your laptop or computer. Not that it would take this long on a calc, unless you're TI, but it would be good. I like how newer Casio calcs do that.
-
Yeah, it won't take long either way. And sleeping the calc would be instantaneous.
-
Sleeping a calc? ???
j/k I know what you mean. :P (although this reminded me so much of "Please SD-Card insert" :P)
-
A winner is you.
-
One question, are you going to set aside the necessary space required for the temporary file? That seems like a lot of space.
-
I was thinking of using the swap sector.
-
Wasn't the swap sector used by OS 2.55MP, though? ???
-
No, every OS needs a swap sector to modify flash, a sector of ROM that isn't used for anything.
-
Oh wait what was I thinking? We're talking about another OS here lol, not a shell. X.x Disregard my question
-
Did not know about the swap x.x
Makes sense now :)
Sounds like a perfect use of it :)
-
Sounds like a great idea. KOS is going to be great. :D
-
I still haven't picked a swap sector x.x I need to do that today.
-
Sounds like a great idea. KOS is going to be great. :D
I didn't think you could pick a swap sector. In which case, what does TI use?
-
I have no idea, but I don't really care what TI's doing.
-
I have no idea, but I don't really care what TI's doing.
Well, maybe you could pick a different one, to spread out the flash wear a bit.
-
I think I'll put it right before the privileged sector. It's a pity that it isn't better organized.