PDA

View Full Version : what is the kernel



gishaust
June 12th, 2008, 01:31 PM
Hi everyone some asked me what is the linux kernel and I could not explain it.

So is someone able to tell me what the linux kernel is. I need it in a "what the linux kernel is for dummies" format. I have look around the net a got a lot of technical stuff.

thanks gishaust

sharks
June 12th, 2008, 01:32 PM
This will answer u:
http://en.wikipedia.org/wiki/Linux_kernel

karellen
June 12th, 2008, 01:50 PM
a simple answer would be "the core of the operation system"

kaboodle_fish
June 12th, 2008, 01:57 PM
a simple answer would be "the core of the operation system"


Very much so

They say a picture is worth a thousand words so

http://widefox.pbwiki.com/f/Monolithic_Kernel.png

NovaAesa
June 12th, 2008, 01:57 PM
An easy way of explaining it (and very simlified) is saying that it is "the bits that go on behind the scenes".

jomiolto
June 12th, 2008, 02:34 PM
Like the engine of a car? It's there and it is what makes the car move, but most people never need to bother with it, as long as it is there and does its job.

Trail
June 12th, 2008, 02:47 PM
In very short, the big guy that does the job of managing resources (CPU, RAM, disks, ...) (providing read/write access to, synchronising, scheduling, ...) and also provides related services to 'user' applications.

aaaantoine
June 12th, 2008, 02:59 PM
kaboodle_fish has it right with the picture link. The kernel is the part of the operating system that deals directly with the hardware. When kernel modules are loaded in, it is so they can also interface with specific components of hardware.

The kernel is the middle man. Software sends commands to the kernel, which in turn communicates with the hardware. It would be impossible to program a piece of software that communicates directly with hardware, unless you have a specific platform in mind, and know all of its intricacies. The benefit of the kernel is, you program one piece of software, and then you can run it on any platform, as long as the kernel is there.

renzokuken
June 12th, 2008, 02:59 PM
this help?

melrom
June 12th, 2008, 04:04 PM
The kernel

We should point out here that the focal point of any operating system is its 'kernel'. Without going into great detail, the kernel is what tells the big chip that controls your computer to do what you want the program that you're using to do. To use a metaphor, if you go to your favorite Italian restaurant and order 'Spaghetti alla Bolognese', this dish is like your operating system. There are a lot of things that go into making that dish like pasta, tomato sauce, meatballs and cheese. Well, the kernel is like the pasta. Without pasta, that dish doesn't exist. You might as well find some bread and make a sandwich. A plate of just pasta is fairly unappetizing. Without a kernel, an operating system doesn't exist. Without programs, a kernel is useless.


SOURCE: http://www.linux.org/lessons/beginner/l1/lesson1b.html

KingTermite
June 12th, 2008, 09:37 PM
Here are some diagrams that might put it in perspective better.

http://photos.sys-con.com/story/res/38276/Haddad-2-Fig1.jpg


This diagram looks like its for a handheld device, but its the same principles.
http://www.openmoko.com/uploaded_images/41.png

Another nice one:
http://myy.helia.fi/~karte/media/linux-kernel-os-distro-app.jpg


Hope that helps somewhat. You kind of need a deeper understanding of Operating Systems (and computer architecutre) to fully grasp the concept. The "core" of the operating system is correct, but that makes little sense to somebody who doesn't understand the full import of what an operating system is.

gishaust
June 12th, 2008, 10:51 PM
Thanks for all your great replies I have been looking at the pics and they have been very useful. I have a second question. So the kernel is really only a heap of drivers that work between the software say apache and the board or are drivers different again?

gishaust

KingTermite
June 12th, 2008, 11:13 PM
Thanks for all your great replies I have been looking at the pics and they have been very useful. I have a second question. So the kernel is really only a heap of drivers that work between the software say apache and the board or are drivers different again?

gishaust
No...the kernel is more than just a heap of drivers.

Some the really important modules in a kernel are:
scheduler - schedules which programs to run, switches between them to give the "appearance" of running simultaneously.

Memory Manager - manages memory used by apps, OS, etc.... Swaps when it needs to, pages in more memory when needed, etc...

Decoder - decodes instructions, and in some cases rearranges instructions or modules to run more efficiently (pipelining and multi-threading, etc...)


I guess in a sense you could kind of claim these are "motherboard" drivers, but I think they are probably still more than just that.

gishaust
June 13th, 2008, 12:14 AM
Oh now i see, then how do bugs come about in the kernel? If everything has a job and it the kernel acts as the middle man and talks between the software package and the boards, cpu, ram and hard drives( I think). What cause a bug?

I am sorry if these are silly questions I am just trying to understand the fundamentals in layman's terms

Bruce M.
June 13th, 2008, 12:51 AM
this help?

Now that is definitely good! Glad to see the sense of humour.

Interesting thread and one I'll watch as I've learned a few things here.

Funny, I always thought of the kernel for Linux as win.exe is to Windows.

Have a good one.
Bruce

Fedz
June 13th, 2008, 12:56 AM
Nothing actually causes the bug as in a virus bug - it's different.

A bug is like a certain part of the code in the kernal that could or maybe been written better/different to streamline it or work better with various software/hardware ...etc.

As new and or modern hardware and software come available, new implimentations that are need or required are written into the code (kernal) for them to work.

The code's that complete anyway the vast majority is already done for quite a long time, I guess it needs tweaking now and again as time goes on ...

I'm not expert but, that's my understanding in laymens terms ;-)

cardinals_fan
June 13th, 2008, 12:57 AM
Oh now i see, then how do bugs come about in the kernel? If everything has a job and it the kernel acts as the middle man and talks between the software package and the boards, cpu, ram and hard drives( I think). What cause a bug?

I am sorry if these are silly questions I am just trying to understand the fundamentals in layman's terms
When a new version of the kernel is written, it has bugs just like any other new software.

Fedz
June 13th, 2008, 01:08 AM
A bit of light reading before bed ;-)

Kernel Comparison: Linux (2.6.22) versus Windows (Vista) (http://widefox.pbwiki.com/Kernel+Comparison+Linux+vs+Windows).

gishaust
June 13th, 2008, 01:30 AM
So a bug really where the software code has trouble talking with the hardware which then cause the computer to do something unexpected!! would that be one way you would explain it?

I didn't realize windows had a kernel it is news to me (long time windows user).

cardinals_fan
June 13th, 2008, 01:35 AM
So a bug really where the software code has trouble talking with the hardware which then cause the computer to do something unexpected!! would that be one way you would explain it?

I didn't realize windows had a kernel it is news to me (long time windows user).
1. A bug is any place in the code where something doesn't work properly / needs improvement. Nothing more, nothing less.

2. All OS's have kernels

A kernel is best summed up by these two sentences from Wikipedia:

As a basic component of an operating system, a kernel provides the lowest-level abstraction layer for the resources (especially memory, processors and I/O devices) that application software must control to perform its function.and
A seed /ˈsiːd/ (help·info) (in some plants, referred to as a kernel) is a small embryonic plant enclosed in a covering called the seed coat, usually with some stored food.

Fedz
June 13th, 2008, 01:38 AM
So a bug really where the software code has trouble with the hardware which then cause the computer to do something unexpected!! would that be one way you would explain it.
In a small way but, something like that scenario is more likely a possible configuration problem with the actual software or the actual software code itself (not the kernel) ...

KingTermite
June 13th, 2008, 02:49 AM
A bug is typically when a programmer makes a mistake in the code. Just like you hear people talk about "gremlins" in a machine that isn't working right, they call them "bugs" in computer world.

The kernel as mentioned earlier has a lot of the basic device drivers in it, so it directly talks to the hardware. So let's give you a small example of what a bug is.

Let's say the application asks the kernel to transfer 15 bytes of data from memory address A to memory address B. A programmer could write a program like this in C:

xfer_mem(fromAddress x, toAddress y, size)
{

for (i=1; i<size; i++)
{
toAddress[i] = fromAddress[i];
}

To call this, the program would have called:
xfer_mem(&A, &B, 15);

Don't worry about A and B...they are just variables. I'm just using them as placeholders as if they were real memory addresses.

Do you see the error this would cause?

i goes from to < 15, so it would only transfer 14 bytes of data.

That would be a BUG!


And cardinal_fan was correct, all Operating Systems have a kernel. It's the core of any OS.

gishaust
June 13th, 2008, 07:54 AM
Wow the response has been fantastic thanks to everyone. But I have been doing some research. When they say the kernel is modular what does this mean? Is it like KingTermite diagram where all the core services are different?

gishaust
June 13th, 2008, 08:03 AM
I have had another thought. If all OS have a kernel then what is so special between say windows, linux and Unix. I am not trying to create a war as the above statement might. I love using linux. But I want to know the fundamentals in layman's terms please.

schauerlich
June 13th, 2008, 08:44 AM
Wow the response has been fantastic thanks to everyone. But I have been doing some research. When they say the kernel is modular what does this mean? Is it like KingTermite diagram where all the core services are different?

Modular means that the kernel is written with different sections of code that can be swapped out for difference pieces of code, and for the most part things will work the way they should if everything lines up right.


I have had another thought. If all OS have a kernel then what is so special between say windows, linux and Unix. I am not trying to create a war as the above statement might. I love using linux. But I want to know the fundamentals in layman's terms please.

The kernel is a very small part of an operating system. All of the layers above the kernel are what make up the majority of an operating system and the majority of what most users see.

BrokeBody
June 13th, 2008, 11:01 AM
Hi everyone some asked me what is the linux kernel and I could not explain it.

So is someone able to tell me what the linux kernel is. I need it in a "what the linux kernel is for dummies" format. I have look around the net a got a lot of technical stuff.

thanks gishaust

In short (roughly),

As the processor is the heart of a hardware, kernel is the heart of a software.

KingTermite
June 13th, 2008, 02:59 PM
Wow the response has been fantastic thanks to everyone. But I have been doing some research. When they say the kernel is modular what does this mean? Is it like KingTermite diagram where all the core services are different?

Modular, yes, is somewhat like the diagrams I posted. It means that the code is very modular versus all jammed together. Modular is typically a better style because each "piece" of code is self contained in a very small functionality and therefore less prone to bugs. Also, its easier to read modular code. It does come with overhead though....you have to fill up the stack pointer with a lot more functions (don't worry about that detail).

Example:

Let's say we are calculating the side of a triangle. The formula is h = sine(x)/o. We have to compute sine manually (e.g. Taylor formula)

Non-modular version

h = x - (x*x*x)/(3*2*1)
h = h + (x*x*x*x*x)/(5*4*3*2*1)
h = h - (x*x*x*x*x*x*x)/(7*6*5*4*3*2*1)
h = h/o
return h


Modular version:

First make module (function) called sine(x)

sine(x)
{
sine = x - (x*x*x)/(3*2*1)
sine = sine + (x*x*x*x*x)/(5*4*3*2*1)
sine = sine - (x*x*x*x*x*x*x)/(7*6*5*4*3*2*1)
return sine
}

Now main (modular version) program becomes:

h = sine(x)/o
return h
-----------------------

Now as for what makes them different if they all have kernels. Well, they all have kernels, but that's like saying all cars have engines. That doesn't make a Ferrari and a Pinto equal cars. The kernels are very different in how they behave, such as how they handle multi-threading, how they handle time slicing the running processes on the cpu, how they manage the memory, etc....

KingTermite
June 13th, 2008, 03:00 PM
In short (roughly),

As the processor is the heart of a hardware, kernel is the heart of a software.

That's only true for Operating Systems or software that has a "kernel". You can't necessarily say that all software has a kernel as most doesn't.

The kernel is essentially an engine. It's software that runs in and endless loop and "runs" things in that loop.

KingTermite
June 13th, 2008, 06:57 PM
A few wikipedia links were placed, I see, but none generically to an OS kernel. They were Linux specific.

Here's a link to the genereal concept of an OS kernel. A pretty good description from what little I've read. If you're seriously interested in understanding, give it a read.

http://en.wikipedia.org/wiki/Kernel_%28computer_science%29

gishaust
June 14th, 2008, 02:45 AM
thanks for the info I like the ferri and pino example I will have a look at the site you gave me

ta

Frak
June 14th, 2008, 02:49 AM
My own definition:

The core of the Operating System that is responsible for bridging the hardware with the software.

gishaust
June 14th, 2008, 07:59 AM
http://en.wikipedia.org/wiki/Kernel_(computer_science)

This articles is great and would highly recommend it thanks KingTermite. But if it was not for the underpinning knowledge everyone gave me I would not have understood it. I am now going to try and understand Privilege rings.I think that creates a lot of issues for me. Does anyone have any advice.