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
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Introduction to Operating Systems.
Lesson complete
Earn the 3 college credits for Introduction to Operating Systems
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Graphical User Interfaces →← 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 →
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.
Enroll now → Course details Download the syllabus All Computer Science courses Every course with PRO →
Compare: Linux vs Operating Systems
Why take it here
Why students take Introduction to Operating Systems with UPI Study
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.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →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?
What is the difference between a kernel and an operating system?
What is the difference between a monolithic kernel and a microkernel?
Why are microkernels used in cars and other safety-critical systems?
About the Introduction to Operating Systems course
How many college credits is Introduction to Operating Systems?
How much does Introduction to Operating Systems cost and what is included?
Which universities accept UPI Study credits?
How long does Introduction to Operating Systems take?
How are the exams done?
How do my credits reach my college?
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
3 credits · NCCRSEnroll →