How does the PC know what to boot on restart

bootbootloaderpower-managementreboot

It is clear that there is some boot sector on my PC which contains the loader with menu, which allows me to choose the OS to load. But, I have noticed that PC does not display me this menu after Windows-restart or Linux-suspend. How does PC, which has lost all RAM decides to bypass the primary boot and load something different?


From what I read about the POST:

In the case of a hard reboot, the northbridge will direct this code fetch (request) to the BIOS located on the system flash memory. For a warm boot, the BIOS will be located in the proper place in RAM and the northbridge will direct the reset vector call to the RAM.

I see that my guess that RAM is lost on restart is wrong.

Best Answer

  • I only know how this works with linux, but I can explain from the grub point of view (a Linux bootloader, others are available).

    Basically, the first thing the boot loader does is check what options it has (it looks at a list of drives). From this, it will see that after a hibernation, your swap partition (Again, there's other ways of storing hibernation data but this is the easiest) contains data and this data is infact hibernation data.

    Once it's seen this, it instantly goes to booting whatever hibernation data exists instead of displaying the boot menu asking which O/S you wish to boot.

    As a side note, I have Grub still display the boot menu even when hibernation data is found, and I can choose to boot without it as an extra option - you might see this if your resuming fails some how.

  • Related Question