Author Topic: Hibernation  (Read 28398 times)

0 Members and 6 Guests are viewing this topic.

SirCmpwn

  • Guest
Hibernation
« 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!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Hibernation
« Reply #1 on: March 03, 2011, 11:37:32 pm »
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.

SirCmpwn

  • Guest
Re: Hibernation
« Reply #2 on: March 03, 2011, 11:38:36 pm »
Yeah, it won't take long either way.  And sleeping the calc would be instantaneous.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Hibernation
« Reply #3 on: March 03, 2011, 11:42:13 pm »
Sleeping a calc? ???

j/k I know what you mean. :P (although this reminded me so much of "Please SD-Card insert" :P)

SirCmpwn

  • Guest
Re: Hibernation
« Reply #4 on: March 03, 2011, 11:43:13 pm »
A winner is you.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Hibernation
« Reply #5 on: March 03, 2011, 11:48:18 pm »
One question, are you going to set aside the necessary space required for the temporary file? That seems like a lot of space.
/e

SirCmpwn

  • Guest
Re: Hibernation
« Reply #6 on: March 04, 2011, 12:34:13 am »
I was thinking of using the swap sector.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Hibernation
« Reply #7 on: March 04, 2011, 12:47:12 am »
Wasn't the swap sector used by OS 2.55MP, though? ???

SirCmpwn

  • Guest
Re: Hibernation
« Reply #8 on: March 04, 2011, 12:49:48 am »
No, every OS needs a swap sector to modify flash, a sector of ROM that isn't used for anything.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Hibernation
« Reply #9 on: March 04, 2011, 12:51:15 am »
Oh wait what was I thinking? We're talking about another OS here lol, not a shell. X.x Disregard my question

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Hibernation
« Reply #10 on: March 04, 2011, 01:43:49 pm »
Did not know about the swap x.x
Makes sense now :)
Sounds like a perfect use of it :)
/e

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Hibernation
« Reply #11 on: March 06, 2011, 02:10:52 pm »
Sounds like a great idea.  KOS is going to be great. :D

SirCmpwn

  • Guest
Re: Hibernation
« Reply #12 on: March 06, 2011, 04:20:33 pm »
I still haven't picked a swap sector x.x I need to do that today.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Hibernation
« Reply #13 on: March 06, 2011, 04:45:22 pm »
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?

SirCmpwn

  • Guest
Re: Hibernation
« Reply #14 on: March 06, 2011, 04:54:24 pm »
I have no idea, but I don't really care what TI's doing.