OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:27 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Lazy-Loading OS
PostPosted: Tue Feb 17, 2015 11:00 am 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
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


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Tue Feb 17, 2015 12:02 pm 
Offline
Member
Member

Joined: Fri Jan 30, 2015 4:57 pm
Posts: 215
Location: Germany
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.


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Tue Feb 17, 2015 12:31 pm 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
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.


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Tue Feb 17, 2015 12:41 pm 
Offline
Member
Member

Joined: Fri Jan 30, 2015 4:57 pm
Posts: 215
Location: Germany
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.


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Tue Feb 17, 2015 12:41 pm 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
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.


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Tue Feb 17, 2015 1:28 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
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


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Tue Feb 17, 2015 4:35 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
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).


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Wed Feb 18, 2015 12:36 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
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


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Wed Feb 18, 2015 12:59 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Wed Feb 18, 2015 1:27 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
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).


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Thu Feb 19, 2015 9:08 am 
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.


Top
  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Thu Feb 19, 2015 9:21 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
Our System/38 used to take well over an hour to IPL (IBM speak for boot). We're spoilt nowadays!


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Wed Feb 25, 2015 12:17 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
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.


Top
 Profile  
 
 Post subject: Re: Lazy-Loading OS
PostPosted: Wed Feb 25, 2015 4:40 am 
Offline
Member
Member

Joined: Sat Mar 15, 2014 3:49 pm
Posts: 96
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 :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group