Macbook Pro has "Hibernate"?

Discussion in 'Mac Pro' started by RichP, Feb 27, 2006.

  1. RichP macrumors 68000

    RichP

    Joined:
    Jun 30, 2003
    Location:
    Motor City
    #1
    Just opened my my macbook pro, which was asleep in my bag over the weekend, and the battery completely drained (no suprise there) However, when I plugged it in and opened it up, I hit the power button, and it gave me a mac gray startup screen, then a grayed out desktop with my programs running, with a status bar over it, once it was done, everything was where i left it, MUCH LIKE A PC HIBERNATE MODE. Did we inherit something here that wasnt in the PPC Powerbooks? :) My G4 never did this..
     
  2. Vlade macrumors 6502a

    Vlade

    Joined:
    Feb 2, 2003
    Location:
    Meadville, PA
    #2
    I have the latest G4 powerbook and it does this.
     
  3. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #3
    That's the Safe Sleep that Apple added to the last batch of PowerBooks. Yep, it's basically the hibernate thing that Wintels have had for ages, but it's much faster.
     
  4. Krevnik macrumors 68030

    Krevnik

    Joined:
    Sep 8, 2003
    #4
    Somewhat. Hibernate actually powers down the system, while Safe Sleep doesn't. Safe Sleep just means that if you lose power while it is asleep for any reason, you will be able to reboot back into the work you were doing, just like you discovered. Hibernate is really just designed to pause the machine while turning it off, saving you a startup time (in theory) or battery life if it is going to be asleep for awhile.

    I noticed it myself when an Apple employee yanked out the battery to scan my MBP to get it registered for an engineering capture while it was still asleep. I would love to know what they are using to store the copy of RAM... is it something flash based, or is it a mix of software and hardware to ensure that the VM pages on the HDD can be updated at a moment's notice with what is needed to have a complete RAM image on disk?
     
  5. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #5
    It's just a plain old swap to disk, OS X just does a check at boot time. If you twiddle a pair of power manglement settings, Safe Sleeps works on any modern Mac, including the desktops.

    There is a little script called PatchSleep that makes enabling the feature painless.
     
  6. Krevnik macrumors 68030

    Krevnik

    Joined:
    Sep 8, 2003
    #6
    To get a swap to disk running that effectively though, they would need to be leveraging parts of the memory model to only dump RAM pages that have changed from the versions on disk. 2GB being dumped to disk is not as fast as this feature is. :D
     
  7. DougBTX macrumors newbie

    Joined:
    Aug 20, 2005
    #7
    But do you ever see it go into hibernation?

    Nope, because it happens during sleep mode, so by definition you're not around to see it. And it is Safe Sleep, not Hibernate, so you'll only ever see it pull *everything* back out of swap when your bettery dies completely. Clever design, no black screen with progress bar that you get with Windows.

    Douglas
     
  8. Kingsly macrumors 68040

    Kingsly

    #8
    My understanding is that whenever you sleep the computer it copies all the info stored in RAM to a cache on the HDD. Then if your battery dies and you plug in the computer takes the disk image of RAM and re-loads it (hence the quick progress bar) Since this is basically the same as Virtual RAM (which OSX seems to be addicted to) it is fast. I think. :D
     
  9. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #9
    Honestly, it's pure software. The dumping isn't hard for Apple to do, because the virtual memory system already keeps track of those things. If you have a desktop Mac handy, use the little script above to enable the feature (it requires a reboot before it will take effect). Then, sleep the machine, observe the time it takes. Finally, pull the plug. on the next start, you'll see the same magic as on the late model PowerBooks and MacBooks.
     
  10. RichP thread starter macrumors 68000

    RichP

    Joined:
    Jun 30, 2003
    Location:
    Motor City
    #10
    Cool, I didnt realize that was also found in the last powerbook revision.
     
  11. Krevnik macrumors 68030

    Krevnik

    Joined:
    Sep 8, 2003
    #11
    Well, it is pure software, I didn't say it wasn't. They would have to plug into the memory model and utilitize it's page tracking data to do it /fast/ though. I haven't delved into the code for XNU's memory management, but if they had code which periodically dumped stale pages out to disk, this would be easy.

    I have seen the feature, and I am aware of how OSes work, being a developer working on aspects of WinCE. We use a pretty modern memory model, which has its ups and downs on such a limited platform. I was just curious as to the model Apple was using to prevent the OS from trying to dump a full RAM image every time you tell the machine to go to sleep.
     
  12. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #12
    The Darwin sources won't tell much, unfortunately, because Apple have decided to keep all the kIOHibernate* stuff private, even the header files :(
     

Share This Page