3 ms·
I would love to see a detailed analysis of various OS boot sequences and times, it is kind of insane that modern computers and phones can take minutes to boot;
by bombcar 4y ago
I would love to see a detailed analysis of various OS boot sequences and times, it is kind of insane that modern computers and phones can take minutes to boot; what ever are they doing?
- secondcoming 4y agoinitialising hardware mostly.
- EscapeFromNY 4y agoOn linux you can use systemd-analyze and get a nice svg waterfall chart of the boot-time dependency chains.
- yjftsjthsd-h 4y agoOn the subset of Linux distros that use systemd, rather. Thankfully, there are other options (https://elinux.org/Bootchart https://elinux.org/Bootchart seems a decent overview)
- freedomben 4y ago> On the subset of Linux distros that use systemd, rather. Worth noting that Fedora, RHEL/CentOS/et al, Debian, Ubuntu, Arch and derivatives use systemd, so odds are pretty high if you use "Linux" you also get systemd
- yjftsjthsd-h 4y agoThat's true; I think the only major user-facing Linux distros without systemd (or with non-systemd versions) these days are Gentoo, Void, Alpine, and Android (which may or may not count). Embedded stuff is probably more of a mixture (openwrt doesn't use systemd, yocto and buildroot can use it but optionally), and firecracker feels closer to embedded than desktop but both ends are interesting. I dunno, I mostly just object to conflating "Linux" with systemd even if it is the most popular option (but bear in mind that I have strong opinions about "Linux" vs "GNU/Linux", so YYMV;]).
- bombcar 4y agoI'd just like to interject for a moment. What you're referring to as Linux, is in fact, systemd/Linux, or as I've recently taken to calling it, systemd plus Linux.
- yjftsjthsd-h 4y agoI mean, I would unironically be fine with people saying systemd/Linux when that's what they're talking about; it's a subset of GNU/Linux and points at what we're talking about pretty easily and specifically...
- taneliv 4y agoAndroid seems to be the most popular Linux distro on the planet, though? Does it use systemd? I was under the impression that it doesn't, but as it often is, I might be wrong.
- freedomben 4y agoTechnically Android runs the Linux kernel, but I wouldn't consider it a "Linux distro" in anywhere near the same sense as I would an Ubuntu or Fedora, etc. The vast majority of Android users don't even know they're running the Linux kernel, which is not true of "distros."
- taneliv 4y agoI would imagine the vast majority of OpenWRT users don't know they're running the Linux kernel. It was installed by the manufacturer or the operator. Assuming that's true, does it make OpenWRT not a distro? I understand your usage of the word "distro". I think it's useful, but also quite a bit misleading (for example, Wikipedia[1] lists Android as a distro). Perhaps there ought to be another word for distributions of Linux that require user to take active part in either replacing a manufacturers' choice or setting it up from scratch on an otherwise "empty" system. But I don't know what it would be. [1] https://en.wikipedia.org/wiki/List_of_Linux_distributions https://en.wikipedia.org/wiki/List_of_Linux_distributions
- freedomben 4y ago> I would imagine the vast majority of OpenWRT users don't know they're running the Linux kernel. It was installed by the manufacturer or the operator. Assuming that's true, does it make OpenWRT not a distro? My gut is to not consider OpenWRT a distro since it's usually just the software part of a network appliance and many/most users don't know they're running it, although I concede that it does qualify in most senses as a distro: downloadable image, a package manager, is a complete product that uses the linux kernel, etc. I fully concede that my opinion of "what makes a distro" is subjective and arbitrary. It's very much the Linux distro version of Stewart's test for obscenity[1] and is a pretty unhelpful standard which value is quite low :-) [1]: https://en.wikipedia.org/wiki/I_know_it_when_I_see_it https://en.wikipedia.org/wiki/I_know_it_when_I_see_it
- ilyt 4y agoSo 95% of the market.
- HeckFeck 4y agoSo systemd comes with its own SVG, and presumably some sort of XML composer. TIL.
- zokier 4y agoYes, hugely complicated XML composer called printf :) https://github.com/systemd/systemd/blob/main/src/analyze/analyze-plot.c#L16 https://github.com/systemd/systemd/blob/main/src/analyze/ana...
- jeffbee 4y agoLarge systems need to initialize a lot of DRAM at power-on but a reboot of a running Linux desktop these days should take single-digit seconds.
- rwmj 4y agoPCI enumeration turns out to be surprisingly slow, especially when virtualized. Access to PCI config space is done by writing an address to one register and reading the data at that address from another register, repeat for every word in the PCI config space for every device. Each of those register reads and writes takes a VMEXIT, so goes through the host kernel and into qemu and back. Oh yeah, and it used to be done twice, once by SeaBIOS and once by the kernel (the SeaBIOS stuff has been optimized since.)
- toast0 4y agoIf you're dealing with modern systems (which would hopefully include virtual machines), the PCI config space can be memory mapped, and then you don't need to read it through the PCI config registers.
- xp84 4y agoI'm basically a 5yo when it comes to hardware - so my apologies for the dumb question - but I wonder naïvely, could this enumeration be completely cached by default? Most computers have most of the important stuff either soldered down (laptops) or at least not swapped regularly. I think I'd sign up immediately for a system where I had to hold a key at startup the first time I installed a new GPU or something, but otherwise it could boot into Windows in 3 seconds. Since most devices that are likely to change are hot-pluggable, I would imagine that those don't need to be checked on at boot time. I'd love to know where I'm wrong on this, though. Perhaps this is part of what Windows does -- I know that it basically keeps a hibernated image of the non-logged-in RAM state, for use when you shut down (and it throws it out if you do an explicit Restart, for troubleshooting reasons)
- MarkSweep 4y agoThe author of the tweet has given talks and made written articles about his work on speed up the FreeBSD boot. Some examples: https://www.daemonology.net/papers/bootprofiling.pdf https://www.daemonology.net/papers/bootprofiling.pdf https://youtu.be/10XRCiBtyhA https://youtu.be/10XRCiBtyhA
- PhilipRoman 4y agoMostly just questionable hardware design and spoiled programmers who want to do too much in early boot. There is no technical reason why you couldn't have a modern desktop booting in a couple of milliseconds. It's a tradeoff between being fast and being compatible with the rest of the world. At the end of the day, boot times are determined not by technical reasons but by how much the users are willing to tolerate. If the market demanded low boot times, the engineers would deliver. But seriously, there is a router that I shall not name here that spends 10 seconds sleeping to avoid a race condition after initializing some irrelevant service. And of course the entire boot process depends on this service.
- pjc50 4y ago> there is a router that I shall not name here that spends 10 seconds sleeping to avoid a race condition after initializing some irrelevant service Reliability is an issue here. There's all sorts of bits and pieces where it's miserably difficult to get a signal or event that something has come up, or there is such a mechanism and it's unreliable. Especially when there's third-party closed drivers or firmware involved. So somebody ends up giving up and putting the delay in, testing it a few hundred times, and declaring it done. But yes, lots of systems could come up faster if enough people cared.
- ilyt 4y ago> Mostly just questionable hardware design and spoiled programmers who want to do too much in early boot. There is no technical reason why you couldn't have a modern desktop booting in a couple of milliseconds. It's a tradeoff between being fast and being compatible with the rest of the world. You wouldn't even be able to initialize CPU & DRAM in "couple of milliseconds" Loading BIOS from flash alone would eat that budget few times over
- xp84 4y ago> not by technical reasons but by how much the users are willing to tolerate. Realizing this one clause is what helped me understand so much, including economics and traffic (induced demand). I call it the "misery constant." Number of lanes doesn't matter: People will adjust their lifestyles until they arrive at the highest level of misery they can tolerate. Add a lane and wait for equilibrium to reestablish at exactly the same level of congestion as before. Add a 10,000% (more??) increase in CPU and disk speed from the 128K Macintosh to the MacBook Pro, and oh look, it takes basically the same amount of time to boot or to launch an application as it did then, as the developers adjusted their wastefulness until they achieved the maximum level of delay the customers were willing to bear.
- silverwind 4y agoCould be worse. Some network routers take up to 30 minutes to cold boot from what I hear, but they essentially never cold boot because they are on UPS.