There are two ways to interpret 'part of the kernel'.
The kernel starts off (on boot) as a file on disk. If you're asking about on disk, they are not part of the kernel, but separate files. Almost all systems now have them as separate files. In really old UNIX days, adding a driver meant adding .o files to the kernel .o files and relinking a kernel.
If you meant 'part of the kernel running image' that depends. Windows can do both. In fact the display driver was moved from being not part of the kernel to being part of the kernel running image some time ago (from nt 3.51 to NT4.0) for performance reasons.
There are two general schools of OS design:
One is called a macrokernel. All OS stuff is handled in a single kernel running image. Linux and most unixes run this way. The advantage is it's fast, all parts of the kernel can read other parts of the kernel and communicate using memory reads and writes. The downside is that this gets messy after a while, and now you need to coordinate usage. If you can do something on purpose, sometimes you can do it on accident. There are no protections, and you may get a kernel panic.
The other is called a microkernel (which Windows NT started out to be, and Windows still sort of is). The theory is that the kernel doesn't do work, but farms out work to special code, but code not running in the kernel memory space. This other code cant touch kernel memory, or anyone else's. The upside, isolation from faults - bad non kernel code can't ruin the kernel. The downside - going back and forth to kernel mode slows things down. This is why the display driver was moved into the kernel in NT 4.0, the slowness.
These are generalizations of course, I haven't followed Windows microkernel design in a while, though I can be relatively sure of Linux design.
MacOSX is actually interesting technically, using a hybrid microkernel/macro-UNIX-kernel design. It used to support old OS9 binaries too - farming out to non-kernel space things that were kernel calls in MacOS9.
DragonFly BSD is an interesting offshoot of FreeBSD that's still a macrokernel, but uses message passing as a kind of poor mans isolation, and makes kernel work easier as a result.
1A few notes, mostly Windows: 0) Drivers generally run in kernel mode (x86 ring 0), but Windows has "User mode driver framework" for ring-3 drivers. 1) Beep is external in
Beep.sys
. 2) You can include additional drivers in the installation media, but not as part of the kernel (NTOSKRNL). The same applies to all Windows releases, Embedded or not. – user1686 – 2011-06-03T19:19:23.0301Further to grawity: Windows NT has no need for drivers to be part of the kernel. Its loader program takes care of the chicken-and-egg problem with boot start class drivers that other systems deal with by combining drivers with the kernel. (This is the case for many if not most protected mode PC operating systems, nowadays, in fact.) – JdeBP – 2011-06-05T14:58:10.503
@JdeBP: But how does it load, for example,
%SystemRoot%\system32\drivers\ntfs.sys
? (IIRC, the boot loader has NTFS support built-in in order to load the kernel, but I don't know about what the kernel does.) // Most Linux systems use an "initrd" archive to load drivers required for booting; would that be the same as Windows "boot start class drivers"? – user1686 – 2011-06-05T15:13:00.2801You've answered your first question in the parenthetical sentence. Your second question is a proper question in its own right, to which the short answer is "No.", and which really is too long to deal with in a comment. – JdeBP – 2011-06-05T15:40:37.240
Well, let me take a shot at it. The BIOS has a service called Int 13h that allows access to hard drives, without the use of drivers as long as the drive is IDE-compliant. (For EFI there are similar services). BIOS loads LBA 0 into
7c00:0000
which is the Windows bootloader. That has just enough intelligence using Int 13h to loadC:\NTLDR
(needed because LBAs are 512 bytes in size), which has enough intelligence to find and load everything else. I'm sure there is shared static code between some Windows drivers (like ntfs.sys and related fat modules to traverse filesystems) and NTLDR. – LawrenceC – 2011-06-05T18:26:38.4631
... except that the process hasn't worked even approximately that way since Windows NT version 5 (Windows NT 6 working quite differently), the process doesn't work at all like that for ARC and EFI, and filesystem recognizers complicate the FSD loading mechanism. As I said, this is too long for comments. Make a question.
– JdeBP – 2011-06-05T19:28:13.283