Find the answer to your Linux question:
Results 1 to 6 of 6
Is it me or is the concept of kernel and kernel modules very difficult to grasp. If somebody's nice enough, please explain to me in laymen terms what exactly the ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    11

    Kernel and Kernel Modules

    Is it me or is the concept of kernel and kernel modules very difficult to grasp. If somebody's nice enough, please explain to me in laymen terms what exactly the kernel is, how kernel modules work, and why do most people build the'yre own custom kernels?

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    What the kernel is: it's the program that runs all your hardware - disks, keyboard, sound card, memory, the lot. It also does the supervisory tasks such as starting all the other programs, assigning resources to them, switching them in and out of the cpu, and cleaning up after them when they terminate.

    In Windows, each piece of hardware has its own separate driver program and all of them are using the system buses at the same time; hence the frequent clashes and freezes. In Linux all the drivers are in the kernel and there are no clashes between them because the kernel always knows what it's doing.

    But having drivers for every possible piece of hardware all incorporated in the kernel would make it ridiculously large and slow. So the Linux kernel is modular: there is a kind of basic kernel and then all the drivers and filesystem readers are compiled as modules which can be linked in when required.

    People used to build their own kernels. Real geeks still do but a lot of us don't bother. The compiled ones that come with your distro are usually good enough.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by romenyrr View Post
    Is it me or is the concept of kernel and kernel modules very difficult to grasp. If somebody's nice enough, please explain to me in laymen terms what exactly the kernel is, how kernel modules work, and why do most people build the'yre own custom kernels?
    The kernel is "the core" of your OS. It's a term that's frequently used in Linux, but in fact, all the OS'es need a kernel in one or another form.

    The kernel manages the resources: cpu, memory and i/o devices (that's basically everything). It's the first program that is started when you boot your OS (if you except the bootloaders and the bios firmware, which is on a previous stage).

    Linux has had traditionally a monolithic kernel, which means that all the drivers and such was embedded into the same kernel, instead of being on separate modules (both things have advantages and disadvantages, that's for another discussion). Lately, the linux kernel has gained some modularity, and now with things like libusd and fuse you can even do drivers on userland (that's also for another discussion).

    In simple words: the kernel is the foundation that's needed by all the rest of programs. It's the one which serves as a bridge between your machine and your software. It decides which program is going to run on a given time slice, and which will be the next one to take time (this is how you can emulate multitasking on a single cpu machine). It also decides how to assign memory to the rest of processes. The programs themselves do not know if they are taking ram or swap memory on a hard drive, or anything else. For they it's just "virtual memory". How that memory is handled, how it's assigned, and where it physically resides it's up to the kernel.

    The kernel also manages i/o devices, which in fact, means any arbritrary peripheral.

    Most distros comes with precompiled kernels, so, unless you need to do some tweaking for any special reason, you shouldn't need to build one.

    In some other cases, for example, metadistros like Gentoo, you need to build your own one.

  4. #4
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    Quote Originally Posted by i92guboj View Post
    with things like libusd and fuse you can even do drivers on userland (that's also for another discussion).
    Pardon me, but what's the point of that? I always thought that one of the great advantages of Linux over all Microsoft systems back to DOS is that only one program - the kernel - is using the system buses at any one time. Why change that?
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  5. #5
    Linux Engineer scrarfussi's Avatar
    Join Date
    Aug 2006
    Posts
    1,029

  6. #6
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    Quote Originally Posted by scrarfussi View Post
    OK, that's for virtual filesystems. But they're really software constructs. What about hardware? What, for example, would be the advantage of having a usb device driver in userspace rather than in the kernel?

    ps I hope we won't be accused of hijacking this thread.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...