How does GRUB know whether to load hibernated image or load kernel from scratch
I understand that when you hibernate the system,a snapshot of the RAM contents is taken and is saved on sawap device. I read that when you select the kernel from your grub menu,it checks the swap device for a swsusp signature and if found then loads the target kernel, otherwise regular boot occurs. So what exactly is "it"? n where does the code to check the signature lie?
Thanks in advance! |
Grub does not know if there is a hibernated system, it always loads the kernel and initrd the same way. It is the kernel/init system itself that looks for the signature and decides to either make a normal startup or restore the hibernated system.
|
Thank you for your reply.
So it is the init system that will always check the active resume device for a swsusp signature.If it finds one, it will load the target kernel and hand over the control to it thereafter. That makes sense. Thanks. Also I was having another minor query as to what should happen to a kernel thread if it is hibernated but the user process whose request it was serving was just killed before hibernating the system? |
The init system will not load a different kernel (what you call target kernel). The kernel always is started first (without a kernel there would be nothing the init system can run on), then the init system is started. If the init system finds the signature it restores the saved state from the disk, otherwise it runs the normal startup sequence.
Quote:
|
All times are GMT -5. The time now is 01:28 AM. |