Lazy-Loading OS

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Lazy-Loading OS

Post by SpyderTL »

Had a couple of thoughts this morning about OS design that I thought that I'd share.

We've discussed the idea of avoiding the Windows "problem" of a) taking 30+ seconds to boot, b) taking 5+ minutes to fully perform startup actions and settle down to near 0% CPU usage and c) trying to Pre-cache as much information as possible, in order to "speed things up".

So, I was thinking about what it would look like to take the "polar opposite" approach, and taking that to the extreme. In other words, what does the OS actually NEED to do during startup? Setup the CPU? Setup the OS memory manager? Load the Kernel into memory? Setup the display? Interrupt handlers? Setup PIC?

Traditionally, you would also do things like setting up a process manager, set up multiple CPUs and APICS, initialize network devices and connections, get IP addresses, load drivers, etc.

But how much could you "put off" until it is actually needed? Could you start up in single threaded mode, with no scheduler, and switch to multi-threaded mode and startup the scheduler if more than one process was started? Could you leave all of the inactive CPUs/cores uninitialized until they are needed? Could you initialize them individually, as needed?

Could you leave, say, 80% of your Kernel on disk until it is needed?

What other things could you delay until absolutely necessary? And what would that OS look like to the user? (Probably a lot like MS-DOS... :))
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: Lazy-Loading OS

Post by Techel »

If you turn on windows' debugging on start you can see the drivers are really taking the most of the time. Other things like intialising harware and cpu should not take as much. So loading drivers on demand is be a good idea.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Lazy-Loading OS

Post by BrightLight »

Roflo wrote:If you turn on windows' debugging on start you can see the drivers are really taking the most of the time. Other things like intialising harware and cpu should not take as much. So loading drivers on demand is be a good idea.
Even if you see what exactly is Windows loading on start-up, it's too much time for little drivers. Linux can load 10 times faster than Windows 8.1 on an Intel Core i3 with 2.40 GHz and 4 GB of RAM (my laptop.)
I just don't get why until now, why is Windows slower than Linux in every aspect?
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: Lazy-Loading OS

Post by Techel »

omarrx024 wrote:I just don't get why until now, why is Windows slower than Linux in every aspect?
I think the biggest problem with windows is compatibility.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Lazy-Loading OS

Post by BrightLight »

Roflo wrote:I think the biggest problem with windows is compatibility.
Compatibility with what?
You know your OS is advanced when you stop using the Intel programming guide as a reference.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Lazy-Loading OS

Post by SpyderTL »

Windows 3.1? I'm pretty sure most applications that ran on Win 3.1 will run on Windows 8.1 32-bit.

That's a lot of baggage to carry around. :)
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Lazy-Loading OS

Post by iansjack »

omarrx024 wrote:
Roflo wrote:If you turn on windows' debugging on start you can see the drivers are really taking the most of the time. Other things like intialising harware and cpu should not take as much. So loading drivers on demand is be a good idea.
Even if you see what exactly is Windows loading on start-up, it's too much time for little drivers. Linux can load 10 times faster than Windows 8.1 on an Intel Core i3 with 2.40 GHz and 4 GB of RAM (my laptop.)
I just don't get why until now, why is Windows slower than Linux in every aspect?
That's interesting. I have the opposite experience. Windows 8 and, to a greater extent, Windows 10 load to a useable state faster than Linux does. They then continue to do some obvious background work for a little while. The biggest culprits for delays seem to be indexing and anti-virus scans. My Linux distribution does neither of these tasks. Another time-waster is checking for updates both from Microsoft and from third parties. It is, of course, possible to turn off all of these activities and so reach a more level playing ground compared with Linux.

I think that Windows has recently made significant strides in reducing start-up times and I believe it is now the best of the bunch (achieved partially through what some might regard as trickery - but if it works, it works).
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Lazy-Loading OS

Post by Roman »

Windows is a full-blown OS. Linux is a kernel. What Linux-based OS are you talking about?
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Lazy-Loading OS

Post by iansjack »

I don't want to get bogged down in semantics. I mean booting a Linux distribution (in this case Fedora and Gentoo installs with various desktop managers) into a state where you can start to do useful work. So I'm using the word "Linux" in the sense that most people use it, as opposed to "the Linux kernel".

I'm saying that my installation of Windows 10 boots to a useable desktop in less time than any of my installed Linux distributions do. Anecdotal evidence, I realize, as most such accounts are.
alexfru
Member
Member
Posts: 1111
Joined: Tue Mar 04, 2014 5:27 am

Re: Lazy-Loading OS

Post by alexfru »

One should take a closer look at the number of processes and threads in their Windows Vista/7. There will be hundreds of threads in the system before one starts the first application after boot. There are a bunch of services and other things that are mostly dormant but contribute to boot time and memory usage because they have to be loaded and they have run until a certain point where they block and start waiting for whatever events they're interested in. My Windows 7 has about 100 services started at the moment and over 100 processes and over 1000 threads. And I have very little software installed and running (the biggest consumer being the web browser with a bunch of pages open in many tabs).
embryo

Re: Lazy-Loading OS

Post by embryo »

SpyderTL wrote:In other words, what does the OS actually NEED to do during startup?
OS needs nothing, but OS users need much more than nothing. So, your question is about users of your OS. Desktop OSes tend to save user's time because users prefer OSes, that save user's time. So, if you set as your goal to decrease user's waiting time, then there is a plenty of solutions available (and you even have listed some of them in your post). But all solutions boil down to minimization of some selected metric. And the metric selected defines how an OS can behave at some stages of it's life, including the startup stage.

If the metric equals to the time spent by a user while waiting from startup to shutdown, then it is required to get representative statistics of usage patterns and next to extract the metric from the statistics. After it is extracted, you need to determine root causes of the user being waiting. Next you need to sort the findings in descending order and start working on every problem from top down the sorted list of causes. But, of course, you can choose another order of your actions, because of required efforts or personal interest, for example. However, general (and most efficient) approach requires that most important problems (in term of metric influence) were solved first.
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Lazy-Loading OS

Post by iansjack »

Our System/38 used to take well over an hour to IPL (IBM speak for boot). We're spoilt nowadays!
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: Lazy-Loading OS

Post by Schol-R-LEA »

Conversely, the Canon Cat was designed so that it appeared to boot in less than five seconds - shorter than the warm-up time of the CRT, sometimes - mainly by saving the previous system state at shutdown, including saving a bitmap image of the screen and loading it to the screen immediately the next time it was booted while the rest of the boot process was going on. This was faster than an average user would react to seeing the screen come up, and gave the illusion that the system came up almost instantly.

While it did have a small battery backup memory, it wasn't a true persistent OS - if the system went down unexpectedly (e.g., a power outage), there was no journal to restore, so it would boot a clean system the next time it was started - but for a simple, no frills system it was apparently quite well designed to ensure minimal user headaches.

It is interesting that the person often called 'the father of the Macintosh' (a title he generally repudiated) went so far out of his way to make such a much simpler system, but Raskin apparently saw the post-Lisa form of the Macintosh project as going away from the 'computing appliance' goal he'd originally envisioned. The Cat was actually his original design for the Mac, circa early 1979, before Jobs got ahold of the project and decided to make it a less expensive version of the Lisa. Unfortunately, by 1987 the design was almost ten years old, and showing its age; but that hardly mattered anyway, as Canon got cold feet after only six months and pulled the plug before it really had a chance to get any significant recognition.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
willedwards
Member
Member
Posts: 96
Joined: Sat Mar 15, 2014 3:49 pm

Re: Lazy-Loading OS

Post by willedwards »

I once cut 10 seconds off of a 30 second smartphone boot time by writing a custom animation library for the swirly boot logo.

When making commercial products there are skilled engineers who analyse boot time and can go as far as reordering function sections in libraries to improve boot.

http://elinux.org/Boot_Time
http://blogs.msdn.com/b/oldnewthing/arc ... 94249.aspx
etc :)
Post Reply