Layers and Kernels, Explained

UPI Study › Courses › Introduction to Operating Systems › Free lessons › Lesson 1.4 Free with a free account

Layers and Kernels

Introduction to Operating Systems · Chapter 1: Operating System FoundationsSection 1.4 · lesson 4 of 837 min · free with a free account

← Kinds of Operating SystemsNext lesson: Graphical User Interfaces →

A free account plays all of Chapter 1 and 3 more lessons of Introduction to Operating Systems. Create a free account →

Earn 3 college credits for Introduction to Operating SystemsRecommended for credit by NCCRS · Computer Science 354 · self-paced · one payment, lifetime access

In this lesson

How layering organizes an OS and three ways to design a kernel.

  • Explain how a layered architecture limits each level to the services just below it
  • Trace a save request down through the layers and back up
  • Define the kernel and distinguish it from the full operating system
  • Compare monolithic, microkernel, and hybrid kernel designs with examples

Free study notes

Get this lesson's notes by email

The key points and 4 practice questions with answers, in your inbox. One email, free.

One email. Unsubscribe in one click.

Transcript

Everything said in the video, section by section (946 words). Read along, or search it.

Opening Question

Built in Tiers Like a Cake

A wedding cake is never made in one piece. Bakers bake each tier separately, stack them, and trust that the top tier won't care how the bottom one was made. Operating systems are built the same way. Millions of lines of code stay manageable, because they're sorted into layers. And where you draw the line around the central layer, the kernel, gives three famous designs, with very different personalities.

Layered Architecture

Each Level Uses Only the One Below

Take Sam, who runs a small online bakery. His order program wants to save a file. If every program had to know the disk's electronics, one tiny change to the disk would break them all. The cure is a layered architecture. Split the system into levels, where each level uses only the services of the level just below it, and offers a simpler service to the level above. Think of a pile of coins. Each coin rests on the one beneath it, and doesn't care what the bottom coin is made of. Swap a layer for a better one that offers the same service, and every other layer is untouched. And a bug can be hunted down, one layer at a time.

The Layers

From Application Down to Hardware

Books draw slightly different lists, but here's a common picture of a modern system. At the top is the application. Below it, the libraries: ready-made code that turns save into a request the OS understands. Then the system-call interface: the one doorway into the kernel. Inside, the file system finds free space and records the name. The device driver speaks the language of this particular disk. And at the bottom, the hardware stores the bits.

Worked Example

One Save Request, Down and Back

Now follow one save request. It travels down: application, library, system-call interface, file system, driver, hardware. Six layers. Then the answer climbs back up, one layer at a time, five hand-offs, until the application hears: done. The application never spoke to the driver, and the disk never spoke to the application.

Definition

The Core That Always Stays Loaded

So what exactly is the kernel? It's the part of the OS that always stays in memory, and runs with the highest privilege. A common mistake is to treat kernel and operating system as the same thing. The kernel is the core, with full control of the hardware. The OS you use every day also includes libraries, services, tools, and often a desktop.

Quick Check

New Lab Disks Need a New Driver

Quick check. Ivy, who looks after the computers at a school, swaps every lab disk for a faster model, from a different maker. In a well-layered system, which software layer has to change? Pause, and decide. The device driver. It's the only software layer that speaks this disk's own language, so a new disk gets a new driver, and the layers above never notice. The file system is the tempting pick, since it decides where data goes. But it asks for space in general terms, the same way on any disk.

Design Question

Inside the Kernel or Outside

Now the big design question: how much goes inside the kernel? Code inside the kernel is fast, because it calls other kernel code directly. But a bug there can bring the whole computer down. Code outside runs under the OS's protection. That's safer, but talking across the wall costs time.

Three Designs

Monolithic, Microkernel, and Hybrid

A monolithic kernel puts nearly everything inside: scheduling, memory, file systems, networking, and drivers. It's fast, but large. Linux is the best-known example, though it can load and unload pieces, called modules, while it runs. A microkernel keeps only the bare minimum inside, such as basic scheduling and passing messages. The file system and drivers run as separate programs. MINIX 3 and QNX are well-known microkernel systems. A hybrid kernel mixes the two: a core designed with microkernel ideas, but with extra services kept inside for speed. Windows and macOS are usually described this way.

Quick Check

A Dashboard Computer That Must Survive

One more check. A car maker is choosing a kernel for the dashboard computer. If the media player's driver ever crashes, the speedometer must keep running, and the driver should simply restart. A little lost speed is fine. Which design fits best? Pause, and decide. A microkernel. The media driver runs as a separate program outside the core, so the OS can stop it and start it again, while the speedometer keeps going. Monolithic is the tempting pick, because it's fast. But there, the driver runs inside the kernel, and its crash takes the kernel with it. That's one reason QNX, a microkernel system, is common in cars.

Real Example

A Graphics Driver Freezes a PC

Ivy has seen the other side. A new graphics driver crashed one of her old school PCs, and the whole machine froze, because the driver ran inside the kernel. Sam summed it up: walls cost speed, but they save the day.

Trade-Offs

No Design Wins Everywhere

No design wins everywhere. A phone maker, a car maker, and a server farm each weigh speed, safety, and ease of change in their own way. Layers hold in all of them. What changes is where the line sits: between trusted and fast, and separate and safe. And layering is an old idea. In 1968, Edsger Dijkstra described a small system called THE, built from strictly separate layers, to keep the design simple enough to check.

Key Takeaways

Layers, Kernels, and Where the Line Sits

To recap. Each layer uses only the one below it, and offers a simpler service to the one above. A request travels down the layers, and the answer climbs back up. The kernel is the always-present core with full control, not the whole OS. Monolithic kernels are fast, microkernels isolate their services, and hybrids aim for a balance.

Try It

Three Layers for a Bakery

Here's something to try on paper. Draw three layers for Sam's bakery: the ordering page, the shop software, and the kitchen equipment. Label what each layer offers the one above. Then ask: if the oven is swapped for a new model, which layers should need to change?

About Introduction to Operating Systems at UPI Study

Introduction to Operating Systems (Computer Science 354) is a self-paced online course of 83 video lessons in 10 chapters, from what an operating system does and process scheduling to concurrency, memory, devices, file systems, networks, the internet, security and virtual machines. It carries a NCCRS credit recommendation for 3 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Compare: Linux vs Operating Systems

Why take it here

Why students take Introduction to Operating Systems with UPI Study

What happens under every app you runIntroduction to Operating Systems explains the software that runs a computer: processes and scheduling, threads and synchronization, deadlock, memory and paging, devices and storage, file systems, networking, security and virtualization. It suits computer science and information technology degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Introduction to Operating Systems carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Layers and Kernels

What is a layered architecture in an operating system?
A layered architecture splits the system into levels, where each level uses only the services of the level just below it and offers a simpler service to the level above. A save request might pass from the application through libraries, the system-call interface, the file system, and a device driver to the hardware. Replacing one layer with another that offers the same service leaves the rest untouched.
What is the difference between a kernel and an operating system?
The kernel is the core of the operating system that always stays in memory and runs with the highest privilege and full control of the hardware. The operating system as a whole is larger: besides the kernel, it includes libraries, services, tools, and often a desktop. Treating the two words as the same thing is a common mistake.
What is the difference between a monolithic kernel and a microkernel?
A monolithic kernel puts nearly everything inside the kernel, including scheduling, memory, file systems, networking, and drivers, which makes it fast but large. A microkernel keeps only the bare minimum, such as basic scheduling and message passing, and runs file systems and drivers as separate programs. Linux is the best-known monolithic example, while MINIX 3 and QNX are well-known microkernel systems.
Why are microkernels used in cars and other safety-critical systems?
Microkernels suit safety-critical systems because a crashed driver or service runs outside the core and can simply be restarted while everything else keeps running. In a car, a failing media player driver should not stop the speedometer. The trade-off is speed, since talking across the wall between separate programs costs time. QNX, a microkernel system, is common in cars partly for this reason.

About the Introduction to Operating Systems course

How many college credits is Introduction to Operating Systems?
Introduction to Operating Systems (Computer Science 354) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Introduction to Operating Systems cost and what is included?
$250, paid once, with lifetime access: all 83 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Introduction to Operating Systems take?
It is self-paced with no deadlines. The 83 lessons total about 10 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 3 credits in Introduction to Operating Systems.

83 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Updated

Introduction to Operating Systems
3 credits · NCCRS
Enroll →