Click to See Complete Forum and Search --> : Windows Vs Linux kernels...I'm confused.


ludwig1
04-07-2004, 06:03 PM
HI,

I've been using Linux for some time and am no where near an expert. However, there is a question I've been meaning to ask for quite some time.

Using Linux , you get to know that the Linux kernel is modular i.e. modules are only loaded into the kernel when needed. My question is: Is this how Windows works too, or is it the case that everything is loaded into Windows from the boot?

Also, another question that is related to this (I think) is again concerning the difference between the two systems: In windows, if you don't have a driver for a new piece of hardware, you just install it. It's quite easy. However, in Linux, if the kernel wasn't compiled with support for the hardware in question, then as far as I can see, there is no way to get the hardware working unless you recompile the kernel. Isn't this a massive drawback of the Linux system? In short, how does Windows allow you to install new drivers without having to recompile the kernel?


Sorry if these questions seem dumb, it's just that they have been bothering me for some time.

Thanks

Ludwig

bwkaz
04-08-2004, 08:50 PM
Windows (NT at least) is a more or less microkernel architecture, I believe. It's a bit different from the Linux kernel.

Normal microkernels (like GNU Hurd) have an extremely small kernel-space layer, then a bunch of user-space processes on top of that layer that do the stuff that kernels do in monolithic architectures. Windows isn't exactly like that (the DLLs of your driver run in kernel space, not userspace), but it's similar -- the kernel proper is relatively (... that is, relative to the rest of the gargantuan OS) small, while most of the work is done by other DLL and DRV files.

Linux is not a microkernel, it's monolithic. Even with kernel modules, it's still mostly monolithic -- the kernel modules run in kernel space. They get linked directly into the in-memory image of the kernel.

However, you do not have to recompile your kernel to support a new piece of hardware. All you need to do is build the .ko module for it, install that module, and load it up. The build architecture that 2.6 uses now is a lot better at that kind of thing, too -- it'll build just one module quite easily. As long as you're using the exact same source tree as your current kernel, it'll be loadable too.

Alternately, you can build everything as modules and use hotplug to load only the proper ones (and then maybe even udev to create the device files on demand). Most distros do something similar to this -- at least, they build everything as modules. They may not use hotplug to load them.

ludwig1
04-08-2004, 09:41 PM
However, you do not have to recompile your kernel to support a new piece of hardware. All you need to do is build the .ko module for it, install that module, and load it up.

Yes, sorry. I was getting confused when I posted that.
In fact I have done this for a modem.I built the driver and installed the module and init scripts .

Can you explain the concept of kernel space and user space?
I haven't heard of that before.

Also, what is the difference between a micro kernel and a kernel?

Also, what would be the equivilent of DLL's in Linux? Are DLL's like modules?


thanks
Ludwig

Alex Cavnar, aka alc6379
04-08-2004, 11:53 PM
I'll see if I can throw a little bit of information in here, with what I know!

Originally posted by ludwig1
Yes, sorry. I was getting confused when I posted that.
In fact I have done this for a modem.I built the driver and installed the module and init scripts .

Can you explain the concept of kernel space and user space?
I haven't heard of that before.


Kernel space is the area of memory reserved for the kernel code to use. User space is for the rest, like applications, etc


Also, what is the difference between a micro kernel and a kernel?


a microkernel is a kernel. If you mean monolithic vs micro, the difference is essentially a question of "what runs in which space?" -- In a monolithic kernel, drivers, network protocols, and other system functions are run in kernel space. wheras the same functions may actally be run as a process in user space in a microkernel.


Also, what would be the equivilent of DLL's in Linux? Are DLL's like modules?


I'm no Windows programming expert, but the closest thing I could find in Linux to a DLL file would be a shared library, like you'd find in /lib or /usr/lib. A Dynamic Link Library (DLL) , as I've been informed, is a file that multiple programs utilize to reference a set of commands common to each program. That, in my eyes, is similar to a shared library under Linux.

Disclaimer: I'm not an expert in this field, just relating my impressions, or at least what I've been able to tell along the way. If anyone can jump in and correct anything I've said, please do so, by all means! :)

ludwig1
04-09-2004, 12:17 AM
thanks Alex Cavnar, aka alc6379.That's very well explained.
I do find tall this quite interesting.
One question that jumps out at me is what would be the advantages (or disadvantages) between an kernel designed as a microkenrel and one designed as a monolithic kernel.It is not obvious to me why one would be better (or worse) than another.

I mean, why did Microsoft decide to make their kernels microkernels and Torvolds decide he wanted a monolithic one?

thanks
Ludwig

knute
04-09-2004, 02:17 AM
Originally posted by ludwig1
I mean, why did Microsoft decide to make their kernels microkernels and Torvolds decide he wanted a monolithic one?

thanks
Ludwig

The answer to this questio requires a short history lesson.

Ok, linux started out as a unix clone, which is a multi-user, networked operating system. It was designed from the bottom up with multiple users in mind, and also security that comes from programmers being curious about what other users are working on. :D

Alright, then Bill Gates, who stole his friends code, and started M$.
This code was designed with being a single user operating system, where you are only running one process at at time. There was no thought to multiple simultaneous users, nor was there any thought into the security of said system at the beginning.

Due to Dos's popularity, because of some very slick marketing, btw, it grew. People started making gui's for dos, so billy jumped onto the band wagon, and made a graphical interface for it, and windows was born.

So now we have an operating system designed for one user at a time, executing one process at a time that has a nice interface (which by the way are more processes that have to be given their due time).

Alright. So now that the history lesson has been put into place sufficiently, we can see the problems inherent in the patched up, souped up dos version, and why user space is used. It has to, because the structure isn't there to be able to handle the additions and subtractions that come with loading and unloading modules into a monolithic kernel (IE linux).

Does that make sense?

Knute

El_Cu_Guy
04-09-2004, 02:56 PM
Windows (NT at least) is a more or less microkernel architecture, I believe.


According to Microsoft, the NT architecture was built on a macro kernel architecture. The reasons for switching to a macro-kernel architecture from a micro-kernel architecture are outlined in MSDN.

Microsoft however, has seemed to follow many of the monolithic concepts over the years.

Alright, then Bill Gates, who stole his friends code, and started M$.

Gates and Kildall were never really friends. They did however, have a friendly relationships in which Gates would do languages and Kildall would do OSes. Gates didn't need to "steal" anything top start [then] Micro-Soft. BASIC was already in the public domain he simply ported it to the ALTAIR. He did later accuse people of stealing HIS work. As for DOS it was licensed code not stolen.

People started making gui's for dos, so billy jumped onto the band wagon, and made a graphical interface for it, and windows was born.

Gates jumped on the GUI bandwagon because of the success of the Mac. Remeber the first 2 versions of Windows were App Suites for DOS not OSes. It wasn't really a GUI for DOS but the apps themselves.

bwkaz
04-09-2004, 07:20 PM
Originally posted by El_Cu_Guy
According to Microsoft, the NT architecture was built on a macro kernel architecture. The reasons for switching to a macro-kernel architecture from a micro-kernel architecture are outlined in MSDN. I stand corrected then. Thanks!

Where on MSDN did you read that, btw? I can't seem to find it... maybe the search terms you used would help me, if you remember them?

El_Cu_Guy
04-09-2004, 07:47 PM
Nope sorry. Stumbled across it.

You'll find, if you read various books and papers, the NT kernel isn't easy to classify.

Although some claim it as such, Windows 2000 isn't a microkernel-based operating system in the classic definition of microkernels, where the principal operating system components (such as the memory manager, process manager, and I/O manager) run as separate processes in their own private address spaces, layered on a primitive set of services the microkernel provides. For example, the Carnegie Mellon University Mach operating system, a contemporary example of a microkernel architecture, implements a minimal kernel that comprises thread scheduling, message passing, virtual memory, and device drivers. Everything else, including various APIs, file systems, and networking, runs in user mode. However, commercial implementations of the Mach microkernel operating system typically run at least all file system, networking, and memory management code in kernel mode. The reason is simple: the pure microkernel design is commercially impractical because it's too inefficient.

Apparently the reference to it as a macrokernel is not accurate. Perhaps it was written backwards,

The monolithic comment by the way refers to the whole OS not the kernel.

EnigmaOne
04-09-2004, 07:57 PM
http://www.microsoft.com/technet/prodtechnol/ntwrkstn/evaluate/featfunc/kernelwp.mspx

ludwig1
04-10-2004, 05:52 AM
Originally posted by knute


Does that make sense?

Knute

Well, I get the history lesson but it really doesn't jump off the page at me why Windows was designed with a micro kernel and Linux with a monolithic one.

I think I get the idea of user-space (memory for applications etc) and kernel space (memory for kernel), but why does Windows use a micro kernel (and hence run kernel processes in user space) whilst Linux runs them in kernel space?
How is that related to the fact that Windows was designed form the beginning with only one user in mind?

Sorry if I'm being dumb

Ludwig

lamatop
04-10-2004, 06:47 AM
Ahh, monolithic vs micro kernels!

Once again the subject resurfaces. This discussion is the very one that prompted the birth of the Linux OS.

Once upon a time there was an OS guru named Andrew Tanenbaum. What, he wrote most of the books used on my university.
Mr. Tanenbaum wrote Minix for education and research, it was an unix-like os with micro-kernel.
In enters a young student from Finland, who has other ideas. Dramatic and historic exchange of ideas take place on usenet.
At one point Tanenbaum writes that if Linus where his student (in os design) he would flunk.

Today Minix is all but dead, Linux is stronger than ever.

WinNT, that started out as micro-kernel apparently now shares much with monolithic kernel design.

A good read on the original discussion :
http://www.dina.dk/~abraham/Linus_vs_Tanenbaum.html

So which is best? Hard to say then, not much easier now.
Microkernels has many theoretical advantages, but often fails to deliver in real life. Monolithic kernel design has proven itself over and over again as reliable. But this doesn't mean microkernels won't take over some day. Who knows.

ludwig1
04-10-2004, 06:59 AM
Originally posted by lamatop
k.



So which is best? Hard to say then, not much easier now.


So, is it fair to say that there is no intrinsic benefit of one over the other?

lamatop
04-10-2004, 07:16 AM
Some of the theoretical benefits from microkernels have been countered in Linux by equally good, alternative implementations.

The most known is the driver issue mentioned elsewhere.
Microkernels allow a driver to run in userspace, that is you can add a driver as easy as starting an app. This has been solved in Linux by the module mechanism, which loads shared libs into the kernel itself.

Today, there is no functionality absent from one that is present in the other. So there is no apparent difference. And by the way there is no true, strict microkernel architecture out there with any noticable marketshare. But interestingly I have heard about people running Linux as an userspace program on top of a microkernel. As in one computer running a microkernel running several Linux as userspace apps.

But things might change : I believe some wifi drivers on linux run in userspace.

Read the link i provided in the earlier post. It's really interesting, and much more can be found by searching on google!

ludwig1
04-10-2004, 08:13 AM
ok ,and thanks for the info.