Linux and windows kernel [closed]
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 ();
}
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.
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.
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.