LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-27-2013, 10:53 PM   #1
linkaran
LQ Newbie
 
Registered: Aug 2012
Posts: 17

Rep: Reputation: Disabled
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!
 
Old 02-28-2013, 04:38 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,411
Blog Entries: 2

Rep: Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995
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.
 
Old 02-28-2013, 09:10 PM   #3
linkaran
LQ Newbie
 
Registered: Aug 2012
Posts: 17

Original Poster
Rep: Reputation: Disabled
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?
 
Old 02-28-2013, 09:27 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,411
Blog Entries: 2

Rep: Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995Reputation: 3995
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:
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?
I don't get that. After the system is restored from the saved state it is exactly like it was before before hibernating, so there is no difference in execution if the system was hibernated in the meantime.
 
  


Reply

Tags
boot, hibernate, snapshot


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grub cannot load my newly installed kernel saman_artorious Linux - Newbie 2 02-28-2012 01:25 PM
kernel image load time... grete Slackware 12 12-11-2009 06:01 AM
grub finds kernel but not able to load/execute it amber_474 Linux - Kernel 7 07-26-2006 03:28 PM
grub doesn't auto-load kernel, time/date auto-change, k3b cannot load kenji1903 Red Hat 16 03-27-2005 08:48 PM
Load Kernel from GRUB manudath Linux - Newbie 6 10-05-2004 09:30 AM


All times are GMT -5. The time now is 03:02 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration