eli5 What’s the difference between os and an kernel

1.19K views

eli5 What’s the difference between os and an kernel

In: 33

33 Answers

Anonymous 0 Comments

The Kernel is the piece of software that is effectively managing requests to your computer’s hardware.

The OS is what we define as the collection of programs that provide the end user experience, the Kernel “is” a program within the OS (it’s the nervous system of the OS so to speak).

The kernel exposes a series of interfaces that your OS applications can utilize to “request” to do things like… start a program, draw something to the screen, take in keyboard input, take in mouse input, etc; if those requests are malformed it will simply return an error, and if those requests are valid it will forward them on to the a relevant subsystem that the Kernel manages to do that work.

Ie. An OS program communicates with the Kernel interface to see what keystroke’s have been hit and the Kernel’s job is to take that request, communicate with the driver system, and then work with that system to well to retrieve those keystrokes.

We split things up this way to improve the reliability / security / and overall consistency of the overall OS; if we need to change how we get keystroke’s it means that we don’t have to change the interface that the OS program is communicating on (hardware changes very frequently, the goal is to limit those changes to the underlying software).

This way if that request to get keystroke’s fails, the Kernel handles it and returns a well formed error or simply no data; if the Kernel simply did that logic it might cause what’s known as a “Kernel Panic”.

It wouldn’t might not know how to handle the error, and then the only thing to do is either exit (crashing the OS) or return garbage (which would harm the stability of the system).

—-

Common responsibilities would include:

* Management of the processes open on the OS (ie. your browser, photo editing app, music player, etc.)
* Management of the file system (if you need to create a file, a request is sent to the kernel, same for reading a file)
* Management of memory (The Kernel, will do things like virtualize the memory available and randomizing locations so that hacker’s can’t easily load viruses onto your computer but it’ll also do things like kill processes to free memory or suspend / hibernate them to a location on the file system… perhaps one of the more complex aspects to a Kernel).
* Management of networked resources (ie. your ability to communicate on the internet)
* Management of CPU resources (ie. Preventing an application from using 100% of the system, hanging it effectively and much much more.)

—-

For instance, on a Window’s machine you have a process called “explorer.exe” this process is the visual interface you see on your screen that lets you click around and well… explore.

It has another process called “system.exe” which is effectively the “Kernel” to Windows; if that process stops or hangs or experiences any trouble… the system will hang and you will need to reboot.

You are viewing 1 out of 33 answers, click here to view all answers.