LWN.net Logo

LPC: Booting Linux in five seconds

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 18:27 UTC (Mon) by flewellyn (subscriber, #5047)
Parent article: LPC: Booting Linux in five seconds

I don't mean to be a wet blanket, but what benefit does fast booting give us, if we don't boot all that often? If we use suspend to disk, or just keep our machines running, what benefit would we derive from this work? Will it help to improve performance in other ways?


(Log in to post comments)

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 19:20 UTC (Mon) by jzbiciak (✭ supporter ✭, #5246) [Link]

In my mind, suspend is something of a hack to get around awful boot times, and it's still flaky for some users. It also doesn't help you at all when you have to install OS updates that require a reboot.

Sure, suspend has other benefits--you can keep all your applications open where you left off--but starting from a clean system often provides a better user experience, unfortunately. (Fortunately, some of the bigger culprits here, such as Firefox, have fixed their memory leaks. The Firefox-2-GMail leak really sucked.)

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 19:25 UTC (Mon) by flewellyn (subscriber, #5047) [Link]

I suppose so. Even so, I'm wondering "what about regular runtime performance? Any benefit there?"

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 19:55 UTC (Mon) by Yorick (subscriber, #19241) [Link]

Any serious effort to bring down boot times will inevitably scrutinise each and every daemon and service started and likely do away with a few less essential ones. As a side-effect, that may very well make a system use less resources and be more stable and secure once the system has been brought up.

I also believe that faster boots give us happier and more productive kernel hackers, because they reboot more often than anyone else. That alone makes it worth the trouble.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 7:40 UTC (Tue) by michaeljt (subscriber, #39183) [Link]

> Any serious effort to bring down boot times will inevitably scrutinise
> each and every daemon and service started and likely do away with a few
> less essential ones.

Or profile how much users of a system use a particular service and start it by default if they use it a lot, or on demand if they use it occasionally.

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 19:58 UTC (Mon) by jzbiciak (✭ supporter ✭, #5246) [Link]

Probably not, as it stands.

I suppose a complex application that takes a long time to start in its own right (OpenOffice, I'm looking at you) might take some hints from the methodology and try to parallelize and optimize its startup tasks. I'm not sure how far you get with a userspace app like that though.

I suppose if you have an embedded device that actually gets powered off and on semi-regularly (media player, cell phone), this work directly impacts the user experience. Those devices could actually boot from scratch rather than dumping state to flash for suspend when they power off. That extends flash lifetime, and it makes startup and shutdown quicker.

My current cellphone takes a good 15 seconds to boot. Booting in 5 would be a noticeable improvement. Granted, I only shut it off when I'm flying somewhere or when the battery gets obnoxiously low, but still, it could make you a favorite with the jet setters. Seeing as there's already interesting Linux distributions running on OpenMoko, I'm sure there's plenty of opportunity for cross-pollination. (Check out this one: http://mobile.slashdot.org/article.pl?sid=08/09/21/1730256 )

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 20:10 UTC (Mon) by flewellyn (subscriber, #5047) [Link]

Of course, I didn't even think of the impact for an embedded environment. You're right, there's a lot of value there for devices that need to turn on and off regularly.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 3:26 UTC (Tue) by mrshiny (subscriber, #4266) [Link]

Also, suspending is not the same as booting when it comes to your
applications. I can suspend my notebook by closing its lid, and when I
come back every single program is exactly where I left it (except for
those that depend on network sockets). This is way better than shutting
down and rebooting; even apps that support session management don't do
that well compared to a nice suspend/resume.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 0:09 UTC (Tue) by rlk (guest, #47505) [Link]

I use suspend as much (or more) because I want to keep everything open with the running state than because of the reboot time. For example, I often have a lot of emacs buffers and xterm windows, and I want that state preserved for as long as possible. I've been known to keep login sessions going for months on end.

With Session Manager, the Firefox annoyances aren't that big of a deal; it's the other stuff I want kept around.

Suspend/resume does not eliminate the need for faster boot time, or vice versa.

suspend vs. reboot

Posted Sep 23, 2008 6:31 UTC (Tue) by Cato (subscriber, #7643) [Link]

I greatly prefer being able to suspend/resume - you have all the state of your applications, down to cursor position in documents, history and scrollback in shells, etc. While Linux's session management is very nice it can't replicate all this, so faster boot doesn't help as much as getting suspend working - I usually don't bother trying to make it work as it's quite a hassle compared to hibernate.

I don't find memory leaks an issue these days - Firefox still crashes enough (due to plugins mostly) that it clears out any leaks in any case.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 13:29 UTC (Tue) by lbt (subscriber, #29672) [Link]

> In my mind, suspend is something of a hack to get around awful boot times,
> and it's still flaky for some users. It also doesn't help you at all when
> you have to install OS updates that require a reboot.

OK - that's your use...

*I* have 6 virtual desktops, eg:
1 with email, a browser window with 15-20 ever changing tabs,
a dev desktop or 2 in various states of compile/dev for multiple projects
an 'office' desktop with maybe OO Writer or Calc or QCAD or...
an admin desktop with windows to various boxen

I have a continually logged on experience interrupted by phone calls, sleep, food, social life, holidays etc - but it's nice to save power at night or when I go for food or go out so I want to hibernate (and I do - I only login/reboot when I choose to upgrade the kernel)

For those who argue that each app should do 'restore state' - why? Debian has what, 22,000 packages many of which would need to be able to restore state. Or we could use hibernate and get them all for free... Hmmm hard choice...

As for "install OS updates that require a reboot." - are you on Linux? This just doesn't happen with any meaningful frequency.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 16:48 UTC (Tue) by bronson (subscriber, #4806) [Link]

Are you talking about suspend or hibernate? Resuming from suspsend takes about 9 seconds on my Thinkpad T42p, while resuming from hibernate takes 1.5 mins. This is unfortunate because cold boot takes less than a minute... I tend to suspend/resume a lot and never ever hibernate.

When Linux supports process suspend/resume, hopefully resuming from hibernate becomes:
- boot in 5 secs
- restore your suspended apps

I can't wait for containerization to hit.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 18:55 UTC (Tue) by jwb (guest, #15467) [Link]

Why does your resume from suspend take so long? On my ThinkPad it takes less than one second.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 20:18 UTC (Tue) by bronson (subscriber, #4806) [Link]

No idea... The CD-ROM drive spins up (no disk in it though), there's some beeping from the speaker, after 3 seconds the backlight turns on, after 5 it switches to a real video mode, and it spends the last second or so drawing the password dialog.

I don't mind too much, 8 seconds is tolerable. At least it never crashes!

LPC: Booting Linux in five seconds

Posted Sep 25, 2008 1:56 UTC (Thu) by deleteme (guest, #49633) [Link]

That's awfully fast, it's more like 1.5 - 3.5 seconds here. The disks starts to spin the screenblinks and take a while to become something usefull-

LPC: Booting Linux in five seconds

Posted Sep 25, 2008 2:49 UTC (Thu) by jwb (guest, #15467) [Link]

Well maybe you're right, because I just took a video of my computer waking from sleep and it takes 6 seconds. However, the time between when the backlight comes on and when the unlock dialog appears is a split second. I guess I was mentally attributing the remainder of the time to the hardware/BIOS.

Which brings us back around to the article. The five seconds of booting does not include the time between power-on and when GRUB hands off to Linux.

LPC: Booting Linux in five seconds

Posted Sep 26, 2008 2:12 UTC (Fri) by njs (guest, #40338) [Link]

I thought restore from hibernate spent most of its time reading the (potentially multi-gigabyte) memory image from disk. Booting doesn't need to load 500 megabytes of firefox into memory, etc.; is there some reason to think that restoring your individual apps would be faster than restoring the hibernate memory image?

LPC: Booting Linux in five seconds

Posted Sep 26, 2008 17:09 UTC (Fri) by bronson (subscriber, #4806) [Link]

Because -- in theory -- you wouldn't have to restore every application, (don't worry about freezing the memory used by all those useless panel apps). And the apps themselves could be smarter (Firefox wouldn't try to persist its in-memory caches). Crash-only apps could just be terminated and re-launched (IM clients, mail clients, etc), no need to write them all out.

I admit, it's all speculation at this point. :)

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 17:04 UTC (Tue) by jzbiciak (✭ supporter ✭, #5246) [Link]

Ubuntu seems to push kernel updates that want a reboot every few weeks. That said, I usually push it to a couple months before I do reboot.

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 20:17 UTC (Mon) by ebirdie (subscriber, #512) [Link]

Together with kernel checkpointing/restart feature, what LWN.net covered in an article a while ago, this could be another possibility to extend battery life ie. when lid closes, checkpoint processes with open file descriptors and below X and shutdown, and then up again in 5 seconds.

At least the fast booting seems to be a simpler way to achieve practically the same goal as the suspend/resume operation has. But the process checkpointing/restarting feature is yet taking its baby steps, so it is practically non-existent. Too bad. I'm haven't found myself comfortable with session features of KDE or Gnome and thus I'm totally relying to suspend/resume to get my desktop back to state, when I left the desktop. And I reboot as seldom as possible - I actually hate system updates requiring reboot or losing the desktop state.

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 21:16 UTC (Mon) by anselm (subscriber, #2796) [Link]

Why would I want to do suspend-to-disk if I can have a clean boot in five seconds? Waking my machine from the suspend takes way longer than that.

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 23:20 UTC (Mon) by nix (subscriber, #2304) [Link]

Your applications might have nonpersistent state you want to preserve.

LPC: Booting Linux in five seconds

Posted Sep 22, 2008 23:49 UTC (Mon) by anselm (subscriber, #2796) [Link]

That's what I used to think, too. Nowadays most of my applications do a reasonable job of coming up again where I left them before a shutdown, so it's not a big deal.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 0:26 UTC (Tue) by rlk (guest, #47505) [Link]

Emacs doesn't; shell buffers and xterms certainly don't have all their state preserved (possibly megabytes of output, and yes, I do care about that). Much less any background processes I happen to have left running actively (Gutenprint tests, for example).

As I said previously, fast reboot and suspend/resume solve different problems and shouldn't be considered alternatives for each other.

That could be fixed

Posted Sep 23, 2008 1:12 UTC (Tue) by JoeBuck (subscriber, #2330) [Link]

It would be possible to make Emacs session-aware.

That could be fixed

Posted Sep 23, 2008 7:29 UTC (Tue) by nix (subscriber, #2304) [Link]

You'd need to modify a good bit of Lisp (at least you'd need to think of
something to do with process sentinels).

Hm, perhaps a shutdown/restart could appear to the Lisp code like all the
process sentinels signalling a process death/network disconnection,
something they have to deal with anyway... obviously you'd also want a
session-save-hook and session-restore-hook, so that things that *want* to
be aware of shutdown/restart can be. (And let's implement it with proper
serialization/deserialization of the in-core Lisp state, not with
unexec()! :) )

That could be fixed

Posted Sep 23, 2008 15:00 UTC (Tue) by shapr (guest, #9077) [Link]

What about emacs desktop? I've been using that for years.
Right now emacs does not save the state of all the open buffers etc until I explicitly exit, but if it saved every minute or so even crashes would have most session state saved.

That could be fixed

Posted Sep 23, 2008 15:14 UTC (Tue) by rlk (guest, #47505) [Link]

The issue isn't just open file buffers:

* Shell buffers (input and output history -- including input and output history of the shell, which isn't quite the same thing as the emacs idea of that)

* Command output buffers and other temporary buffers, including *scratch*

* Files that you're looking at that may get changed behind your back that you deliberately haven't reverted yet.

* The state of the lisp world

Obviously, emacs loses all of this if it crashes, but this in the context of choosing to reboot vs. suspend/resume. I'll take my chances on crashes, and I do save my work, but it's still more efficient to keep a session going as long as possible.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 7:54 UTC (Tue) by michaeljt (subscriber, #39183) [Link]

> Nowadays most of my applications do a reasonable job of coming up again
> where I left them before a shutdown, so it's not a big deal.

But they can take an awful long time to do so. Don't know if suspend/resume is faster, because I have never trusted it enough to find out. Perhaps a middle way would be best of all - suspending and resuming individual applications, perhaps even with the application's cooperation.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 8:23 UTC (Tue) by michaeljt (subscriber, #39183) [Link]

Ahem, actually exactly what ebirdie said in a comment further up.

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 16:56 UTC (Tue) by s0f4r (guest, #52284) [Link]

Please follow this calculation:

Writing on cheap SSD's maxes out at maybe 10MB/sec max., reads at 30MB/sec max sustained. Suppose that you have a laptop with 512mb memory. It will take 51 seconds to suspend to disk. It will take 17 seconds to resume from disk.

suspend to disk is just not the answer :)

LPC: Booting Linux in five seconds

Posted Sep 23, 2008 17:05 UTC (Tue) by flewellyn (subscriber, #5047) [Link]

I wouldn't trust an SSD, especially not a cheap one, as a root disk.

Flash life

Posted Sep 23, 2008 21:27 UTC (Tue) by man_ls (subscriber, #15091) [Link]

Because of the limited number of rewrites? With 100,000 rewrites and if you suspend 10 times an hour, 8 hours a day your Eee will last 3.5 years. Add some wear levelling, 200,000 rewrites or a half-full memory and you can stop worrying.

Flash life

Posted Sep 24, 2008 0:41 UTC (Wed) by flewellyn (subscriber, #5047) [Link]

Yeah, I'd heard that before, but Val Henson wrote a <a href="http://valhenson.livejournal.com/25228.html">blog entry</a> which made a strong counterargument.

Flash life

Posted Sep 24, 2008 6:49 UTC (Wed) by man_ls (subscriber, #15091) [Link]

Thanks for the link. It is not so convincing though: even without any wear levelling there is a big safety margin.

But if flash memory life really worries you, you can buy an 8GB SD memory card for $20, stick it into your Eee and place the most frequently written-to filesystems (/var, swap) on it. If it ever goes wrong you just replace it (and maybe get a new one for free if inside the 5-year warranty).

I have a similar setup and it works fine. Just be sure to buy a fast SD card or suspend will take a long time.

Flash life

Posted Sep 25, 2008 1:59 UTC (Thu) by deleteme (guest, #49633) [Link]

I've been running on Compact Flash since 2005 works fine.

LPC: Booting Linux in five seconds

Posted Sep 25, 2008 7:27 UTC (Thu) by NCunningham (guest, #6457) [Link]

You're not accounting for compression. Yes, swsusp doesn't do compression, but the other implementations do. You generally get about 50% compression, so half the times for reading and writing.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds