9

I work on Linux and a friend on a Windows 7.

I was amazed about the speed that NetBeans, Eclipse, pgAdmin and other programs open a lot, really, a LOT faster on Linux than on windows.

What is the main difference between Linux and windows kernel that causes that time load difference?

Both machines have exactly the same hardware configuration.

3
  • 1
    Funny, my experience is exactly the opposite - on all of my PCs, programs in Windows tend to load a lot faster than on Linux (especially under Windows 7, which guesses which programs you will open based on past usage, and preloads them into memory). Perhaps his Windows machine is full of bloatware? Is the company anti-virus Windows-only? Have you tried running Linux on the same machine (failing hard-drives affect load times drastically). Jun 14, 2012 at 21:53
  • @BlueRaja-DannyPflughoeft thanks for your comment. As I told on the question, both machines have the same hardware configuration, both came with windows 7 but I'm a Linux user and no, his windows is not bloated
    – user23907
    Jun 15, 2012 at 11:40
  • 1
    @BlueRaja-DannyPflughoeft I found interesting thing that after an antivirus to a Windows is set, it becomes much more laggish. So, in fact, no need in a bloatware, just install an antivirus. The GNU/Linux doesn't need one (at least yet), and this small thing gave much more performance also.
    – Hi-Angel
    Aug 25, 2014 at 13:00

4 Answers 4

7

This is just my guess, but I think that when you work for a company, where once everything is compiled (converted to binary data, which computers can execute), nobody can see the source code anymore, you tend to be a lot lazier, as it doesn't matter as long as it works.
Linux is open source, so everyone can see the source code if they would wish to do so. If you are lazy, and write a really crappy piece of code which will really slow down the system or something of the sorts, there goes your reputation, as everyone just saw. Developers and users alike. I think that's one of the reasons why open souyce developers tend to be less lazy.

It's also a fact that the core of the Windows kernel was never written with the intention of becoming what it is today (neither was Linux', but they did the effort to optimize the old bits), and developers have simply always been adding and adding on top of it, until the code was so cryptic that nobody could make something out of it anymore. Two properties of messy code is that there's often a lot of redundancy, and that you don't see the links between two pieces of code so easily anymore, which makes that you can't even try to start optimizing it. Just an example (not a cryptic one);

for (int i = 0; i < 20; i++)
{
    if (x == y)
    {
        if (z <= u)
        {
            goto banana;
        }
    }
}

The example above could be done much more efficiently;

for (int i = 0; (i < 20) && (x == y) && (z <= u); i++)
{
    banana ();
}
3
  • 1
    I believe in the programmers area, the current consensus is that lazy and/or sloppy coding is well optimized in the compilers. However, compilers can't help bloat and legacy, which might be there -- and related to your intent.
    – Krista K
    Jun 14, 2012 at 20:00
  • 4
    Both of those code examples will almost certainly compile to the same thing (minus the function-call vs. goto)... Jun 14, 2012 at 21:54
  • @BlueRaja-DannyPflughoeft I know, but I needed a simple example to explain it.
    – RobinJ
    Jun 15, 2012 at 9:14
4

Another big one not mentioned yet is that Linux has better filesystems. NTFS's performance with small files isn't that great -- ext3 is better, and ext4 is much, much better. There's some interesting speculation on why in another question.

When you're opening a program, a significant amount of the startup time is loading a bunch of tiny files from the disk, so having a filesystem that does that quickly is very important.

3

This is just my opinion but i think there are various reasons for GNU/Linux systems being faster than Windows and not all are related to kernel:

  • Obviously there is the reason explained by RobinJ, it's quite obvious that if software is open source the code tends to be more efficiently-written
  • Linux makes use of very optimized components for example it uses a very optimized scheduler that tends to maximize CPU utilization.
  • Linux systems suffer less from memory fragmentation
  • Linux systems have a better use of the main memory and usually tend to massively use cache, Windows systems instead tend to massively use virtual memory
  • Linux kernel is continuosly updated and useless parts are usually removed, although Linus Torvalds said that Linux kernel is becoming "huge and bloated", in opposition updates to the NT kernel are usually built on top of the existing ones.
2

I believe the kernel alone isn't the answer. Windows 7 is the first time Windows was responsive enough that I consider it to be acceptable.

I believe more of the speed differential is related to @RobinJ's thoughts on software engineering. Everything* in Windows is built on the MSDN via some kind of Microsoft framework or another. This is actually related to how Big Business loves Microsoft; Microsoft is all about helping different programs/suites/technologies talk to each other.

Next... to make it easier for the developers to have the essentials covered (and not reinvent the wheel) Microsoft allows makers to bundle and/or require precompiled libraries like Microsoft Visual C++ 2008 Redistributable. Or .Net4.0, MSSQL 2005, ad nauseum. There are something like ten years worth of packages developers can use and build upon and require end users to install on their Windows computers in order to use the new software.

So in order for program Zyzzyx to load and run, one or more MSDN redistributable libraries have to be present and running. These libraries determine how programs interact with the OS.

To boil it down, I would opine that Window's intentional compatibility across decades of software makes it bloated and occasionally more slow than a comparable linux system. Also note that I have developed visual software for windows but not any for linux... not GTK, Qt, Py, anything, so my assumptions about linux being less bloated are just that.

edited to add: further, FOSS software does have people improving it all the time, so GTK will improve as time passes rather than GTK-2005 and GTK-2008 being on same computer, while Microsoft does that all the time.

*- ok there are exceptions, I'm sure.