We may earn an affiliate commission when you visit our partners.
Daniel McCarthy

This course is designed to teach you how to create your very own multitasking operating system and kernel from scratch. It is assumed you have no experience in programming kernels and you are taught from the ground up.

Real Mode Development

Real mode is a legacy mode in all Intel processors that causes the processor to start in a legacy state, it performs like the old 8086 Intel processors did back in the way.

Read more

This course is designed to teach you how to create your very own multitasking operating system and kernel from scratch. It is assumed you have no experience in programming kernels and you are taught from the ground up.

Real Mode Development

Real mode is a legacy mode in all Intel processors that causes the processor to start in a legacy state, it performs like the old 8086 Intel processors did back in the way.

In the "Real Mode Development" section of the course we start by learning about the boot process and how memory works, we then move on to creating our very own boot loader that we test on our real machine. This boot loader will output a simple "Hello World. " message to the screen and we write this boot loader in purely assembly language.

In this section we also read a sector(512 bytes) from the hard disk and learn all about interrupts in real mode and how to create them.

This section gives you a nice taster into kernel development, without over whelming you with information. You are taught the basics and enough about the legacy processors to be able to move forward to more modern kernel development further into this course.

Protected Mode Development

In this section we create a 32 bit multi-tasking kernel that has the FAT16 filesystem. Our kernel will use Intel's built in memory protection and security mechanisms that allow us to instruct the processor to protect our kernel and prevent user programs from damaging it.

This section is very in depth, you are taught all about paging and virtual memory. We take advantage of clever instructions in Intel processors to allow all processes to share the same memory addresses, this is known as memory virtualization. We map memory addresses to point to different physical memory addresses to create the illusion that every process that is running is loaded at the same address. This is a very common technique in kernel development and is also how swap files work (Those files that are used to compensate for when you run out of usable RAM).

We create our own virtual filesystem layer that uses a design that is similar to the Linux kernel. This clever abstraction that will be taught to you was inspired by the instructors knowledge of writing Linux kernel drivers in his past.

You are taught about the design of the FAT16 filesystem and how the FAT16 filesystem is broken down into clusters and that they can chain together. We then implement our very own FAT16 filesystem driver allowing files to be born.

We implement functionality for tasks and processes and write our own keyboard drivers.

In this course you also get to learn how memory management works, we implement the "malloc" and "free" functions creating our very own heap that's designed to keep track of what memory is being used. Memory management is essential in any operating system and kernel.

Let us not forget that we even create an ELF file loader, we will compile all our operating systems programs into ELF files and allow the loading of binary programs or ELF programs. ELF files contain a lot of information that describes our program for example where our program should be loaded into memory and the different sections of the program.

By the end of this course you will have a fully functioning 32 bit multi-tasking kernel that can have many processes and tasks running at the same time. You will have a working shell that we can use as well.

Assembly language bonus

This is a bonus section designed to bring your assembly skills up to scratch should you struggle a little bit with the assembly language in this course. It's however advised you come to this course with experience in assembly language, we do use it and its important. Never the less if you want to take a chance on this course with no assembly experience then this section will help point you in the right direction so your able to take what you learned and apply it to the kernel.

Taught by an expert that has created Linux kernel modules professionally in the work place. 15 Years Experience As A Software Engineer

Enroll now

What's inside

Learning objectives

  • How to create a kernel from scratch
  • How to create a multi-tasking kernel
  • How to handle malicious or problematic programs in your operating system. terminating them if they misbehave.
  • How memory works in computers
  • The difference between kernel land, user land and the protection rings that make up modern computing
  • Kernel design patterns used by the linux kernel its self
  • You will learn all about virtual memory and how to map virtual addresses to physical addresses
  • You will learn how to make the kernel understand processes and tasks
  • You will learn how to load elf files
  • You will learn how to debug disassembled machine code
  • You will learn how to debug your kernel in an emulator with gdb.
  • Show more
  • Show less

Syllabus

Introduction

In this lecture we download the code for GCC compiler and recompile it with special settings that allow us to write our kernel in C safely without running into additional problems than a normal GCC compiler would cause.

Read more
This section introduces you to the basic theory behind kernel development, memory is explained and the boot process. We also install dependencies we need.
What Is Memory?
The Boot Process
Installing What We Need For Real Mode Development
In this section you learn how to program a real mode kernel
Hello World Bootloader

Learn all about real mode

Segmentation Memory Model
Improving Our Bootloader
Preparing our bootloader to be booted on real hardware

In this lecture we take our revised bootloader and burn it to a USB disk so that we can boot from it with your real machine in the next lecture!

Here we boot from the bootloader on our real machine allowing us to see the message "Hello World!" appear on our real computers

The Interrupt Vector Table Explained
Implementing our own interrupts in real mode
Disk Access And How It Works

In this lecture we read a sector from the hard disk. This will be your first experience with communicating with storage devices in this course.

In this lecture we cover protected mode development. We introduce memory protection and the use of 32 bit operations. We build a 32 bit kernel.
What is Protected Mode?
Switching To Protected Mode
Restructuring Our Project
Enabling the A20 line

In this lecture we load our 32 bit kernel into memory and execute it.

In this lecture we create cleaning functionality in the Makefile to allow us to clean our project solution and delete object files.

In this lecture we cover how to avoid alignment problems when mixing C and Assembly code.

In this lecture we start writing C code in our kernel for the first time!

In this presentation you learn about the text mode in legacy and modern systems.

In this lecture you learn how to write to the screen in the C programming language in your new 32 bit protected mode kernel!

In this lecture you will learn how interrupts work in protected mode, its a little different to real mode. Watch this presentation!

In this lecture we take what we learned in the last lecture and we actually implement our own interrupt descriptor table. Allowing us to have our own custom interrupts in protected mode!

We use "in" and "out" instructions to talk with hardware on the mother board through the use of the bus. This lecture teaches you how to do just that in the C programming language!

The programmable interrupt controller is an important part of modern computing. Learn all about it in this presentation.

Now your at this lecture you know all about the programmable interrupt controller, we are now ready to communicate with the controller in our kernel!

In this presentation we discuss the heap and memory allocation in detail ready to prepare you for creating your own heap and gaining access to malloc and free functions.

In this lecture we implement our heap that we discussed about in the last lecture

In this lecture we make two C functions, one for enabling interrupts and one for disabling them.

In this lecture you learn all about paging and how virtual memory has changed the world. You will learn how it works so your ready to implement it in your kernel further in this course.

In this lecture we implement paging in our kernel

In this lecture we implement the ability to modify the page tables.

In this presentation we learn how to read from the hard disk in protected mode.

Reading from the disk in C with the ATA controller

In this lecture we improve what we made in the last lecture. Improving our disk drivers design.

Files are an important part of any operating system. They are not part of the hard disk. Files are inside filesystems which are a structure on sectors in a hard disk. Learn all about filesystems in this lecture.

In this lecture we create a path parser, allowing us to parse path strings into structured elements.

In this lecture we create a disk stream that allows us to easily read from an absolute position in the disk. It allows us to treat the disk as if its a giant file which allows for ease of access when reading from the disk.

We have already explained briefly about filesystems. Let's now take it further, in this lecture you will learn what the FAT(File Allocation Table) is and how it works!

In this lecture we take our knowledge gained from the FAT(File allocation table) lecture and start building our very own FAT file system driver.

In this lecture you learn about the virtual file system layer and why it is important and allows for an infinite number of filesystems to exist in an operating system.

In this lecture we start implementing the virtual filesystems core functionality that file systems driver we build later on will be able to use.

In this lecture we start writing the core functionality for our FAT16 filesystem driver.

In this lecture we implement the C structure that represent entities in a disk that has a FAT filesystem.

Implementing The FAT16 Resolver Function
Implementing the VFS fopen function
Implementing FAT16 fopen function

In this lecture we implement the virtual filesystem layer part for reading from files.

In this lecture we implement the FAT16 fread function which allows us to read files from the FAT16 filesystem.

In this lecture we implement the virtual filesystem layer for file seeking.

Implementing the FAT16 fseek functionality
Implementing the fstat VFS functionality
Implementing the FAT16 fstat function
Implementing the VFS fclose functionality
Implementing the FAT16 fclose functionality

Learn how to cause your kernel to halt with an error message with this easy to implement kernel panic function

User land has lower privilege levels than kernel land. Learn all about the difference in this lecture to ensure your user programs cannot take over your kernel.

We must change our kernel code and data segments to be written in C for good efficiency

In this lecture we implement the TSS(Task switch segment) this is a powerful Intel data structure that assists us with multi-tasking

In this lecture we implement the possibility for tasks. Think of threads in modern operating systems. This is the foundations of multi-tasking.

In this lecture we start making the process foundations which will be an important part of our operating system in later lectures when we start creating user programs.

Implementing Process Foundations Part 2
Packing the GDT
Implementing User Land Functionality
Creating our first user process application

Executing our user process code for the very first time!

Changing the paging functionality
Talking with the kernel from userland
Creating the interrupt 0x80 for user process to kernel communication
Creating the ability to create and execute kernel commands
Creating our first kernel command

In this lecture we call our very first kernel made command from our user program!

Copying strings from the tasks process
Reading the task's stack
Creating the print command in the kernel

Keyboard access is done differently than in real mode. Find out what you need to know in this presentation!

In this lecture we create a virtual keyboard layer which which can interface with our keyboard driver later in the course.

Creating the PS2 port keyboard driver part 1
Improving our interrupt descriptor table design

In this lecture we take the basic concept of interrupt handlers that I shown you earlier in the course and we enhance it making it very flexible, powerful and easy to use.

In this lecture we allow our kernel to understand that we can have more than one process. Processes can be active or not. Active processes are where key strokes will be sent too later on in the course.

Creating the PS2 port keyboard driver part 2
Getting a key from the keyboard buffer in user land
Creating a putchar command that writes one character to the terminal
Implementing backspace in the terminal
Revising our stream reader

In this lecture I explain to you what ELF(Executable Linkable Format) files are, this is important to know for when we load elf files further in the course.

Our programs need an executable format, we have chosen the ELF format for all non-binary executable files. In this lecture we begin to implement the loader that can load and understand these ELF file programs.

Implementing The Elf Loader - Part 2
Implementing The Elf Loader - Part 3
Implementing The Elf Loader - Part 4

Save this course

Save Developing a Multithreaded Kernel From Scratch! to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Developing a Multithreaded Kernel From Scratch! with these activities:
Review Assembly Language Fundamentals
Reinforce your understanding of assembly language, which is crucial for understanding the boot process and low-level kernel interactions.
Browse courses on Assembly Language
Show steps
  • Review basic assembly syntax and instructions.
  • Practice writing simple assembly programs.
  • Study memory addressing modes in assembly.
Practice Assembly Code Debugging
Improve your ability to debug assembly code, which is essential for kernel development.
Show steps
  • Find assembly code snippets with errors.
  • Use a debugger to step through the code and identify the bugs.
  • Correct the errors and test the code.
Read 'Operating System Design and Implementation'
Gain a deeper understanding of operating system principles and design considerations.
View Melania on Amazon
Show steps
  • Read the chapters on process management and memory management.
  • Study the code examples provided in the book.
  • Compare the book's approach to the course's implementation.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Create a Glossary of Kernel Development Terms
Reinforce your understanding of key concepts by creating a glossary of terms used in kernel development.
Show steps
  • Identify key terms from the course materials.
  • Write clear and concise definitions for each term.
  • Organize the terms alphabetically or by topic.
Write a Blog Post on Virtual Memory
Solidify your understanding of virtual memory by explaining the concepts in a clear and concise manner.
Show steps
  • Research different virtual memory techniques.
  • Outline the key concepts to cover in your blog post.
  • Write a draft and revise for clarity and accuracy.
  • Publish your blog post and share it with others.
Implement a Simple Shell
Apply your knowledge of system calls and process management by building a basic command-line interpreter.
Show steps
  • Implement command parsing and execution.
  • Handle basic system calls like `fork`, `exec`, and `wait`.
  • Add support for input/output redirection.
  • Implement job control (e.g., background processes).
Read 'Understanding the Linux Kernel'
Explore the design and implementation of a widely used operating system kernel.
Show steps
  • Read the chapters on process scheduling and memory management.
  • Compare the Linux kernel's approach to the course's implementation.
  • Identify the key differences and similarities.

Career center

Learners who complete Developing a Multithreaded Kernel From Scratch! will develop knowledge and skills that may be useful to these careers:
Kernel Developer
A Kernel Developer specializes in creating and modifying the core of an operating system, the kernel. This course specifically focuses on teaching how to create a kernel from scratch, which is directly relevant to the Kernel Developer's work. The course delves into real mode and protected mode development, covering memory virtualization, file system drivers, and process management. Taking this course helps build a foundation in debugging disassembled machine code and debugging a kernel in an emulator with GDB. Due to this course's coverage of kernel design patterns used by the Linux kernel, a Kernel Developer might find it invaluable.
Operating Systems Engineer
An Operating Systems Engineer designs, develops, and maintains operating systems. This course on developing a multithreaded kernel from scratch directly aligns with the responsibilities of an Operating Systems Engineer. The course covers essential topics such as real mode development, protected mode development, memory management, virtual file systems, and multitasking. The engineer can apply the knowledge of boot processes, interrupt handling, and memory protection learned from the course to create robust and efficient operating systems. Learning how to design kernel-level functionalities can help with creating operating systems.
Systems Programmer
A Systems Programmer develops and maintains system-level software, including operating systems, compilers, and utilities. This course on building a multithreaded kernel from scratch is applicable to this role. The course covers memory management, virtual file systems, and multitasking, which are all relevant to systems programming. The Systems Programmer may find the section on kernel design patterns helpful when implementing efficient and reliable system software. Learning about debugging disassembled machine code and how to debug kernels can help with troubleshooting system-level issues.
Security Engineer
A Security Engineer focuses on protecting computer systems and networks from threats. This course helps a Security Engineer understand how operating systems and kernels work, so they can identify and mitigate security vulnerabilities. The engineer can apply the knowledge of memory protection, process isolation, and interrupt handling to secure system-level software. The coverage of debugging disassembled machine code and how to handle malicious programs helps the Security Engineer analyze and respond to security incidents.
Virtualization Engineer
A Virtualization Engineer implements and manages virtualized computing environments. This course helps a Virtualization Engineer understand core concepts of operating systems, particularly memory virtualization and process management. The Virtualization Engineer can apply the knowledge of virtual memory and how to map virtual addresses to physical addresses when configuring and troubleshooting virtual machines. The course’s emphasis on multitasking and process handling can help the engineer optimize the performance and stability of virtualized environments.
Reverse Engineer
A Reverse Engineer analyzes software to understand its functionality, often to identify vulnerabilities or to achieve interoperability. This course can help a Reverse Engineer understand the inner workings of operating systems and kernels. The Reverse Engineer can then apply the knowledge of memory management, virtual file systems, and multitasking to analyze system-level software. The course covers ELF file loading and debugging disassembled machine code, which may be useful for the Reverse Engineer when examining executable files and system processes.
Embedded Systems Engineer
An Embedded Systems Engineer designs, develops, and tests software for embedded systems, often working close to the hardware level. This course may be useful as it teaches how to create a multitasking operating system and kernel from scratch, including real mode development, protected mode development, and memory management. This course can help the engineer understand how to create low-level systems. The course's assembly language bonus and its handling of hardware interrupts may benefit an Embedded Systems Engineer when optimizing performance and managing resources in embedded environments.
Firmware Engineer
A Firmware Engineer develops low-level software that controls hardware devices. This course may provide the engineer with insights into operating system principles and kernel development, which can translate into creating more efficient and reliable firmware. The course teaches real mode development, protected mode development, and memory management. A Firmware Engineer who builds their understanding of assembly language and hardware interrupts can write firmware that interacts effectively with hardware components. They could also leverage gained knowledge for memory management and process handling in firmware development.
High-Performance Computing Engineer
A High Performance Computing Engineer (HPC Engineer) designs, optimizes, and maintains high performance computing systems. This course may provide insights into kernel development, memory management, and multitasking, which are essential for optimizing HPC applications. The HPC Engineer can apply the knowledge of virtual memory, process isolation, and interrupt handling to improve the performance and scalability of HPC workloads. The course’s learning objective of how to handle malicious or problematic programs may also be useful for preventing system instability.
Game Engine Developer
A Game Engine Developer creates and maintains the software frameworks that power video games. This course may be useful as it provides insights into operating system principles, memory management, and multitasking. Game Engine Developers can apply the knowledge gained from the course on virtual memory and process handling to optimize game performance. The course's emphasis on low level programming and ELF file loading may help with creating efficient and secure game engines.
Application Security Engineer
An Application Security Engineer specializes in securing software applications. This course may be useful in improving their understanding of operating system principles and low-level programming. The Application Security Engineer can apply the knowledge of memory protection and process isolation to identify and mitigate security vulnerabilities in applications. Learning how to handle malicious programs may help the engineer design robust security measures for application software.
Cloud Engineer
A Cloud Engineer designs, deploys, and manages cloud computing infrastructure. This course may be useful as it provides insights into operating systems and kernel development, which are foundational to cloud environments. The Cloud Engineer can then apply the knowledge of memory management, process isolation, and virtual file systems to optimize cloud resource utilization. Understanding kernel design patterns taught in the course can help a Cloud Engineer build and maintain scalable and reliable cloud services.
Robotics Engineer
A Robotics Engineer designs, builds, and programs robots and automated systems. This course may be useful as it may provide insights into operating system principles, real-time processing, and low-level programming. The Robotics Engineer can apply the knowledge of memory management, interrupt handling, and multitasking to optimize robot control systems. The course can inform an engineer of low level robot operation and the potential for custom operating systems.
Software Architect
A Software Architect designs the high-level structure of software systems. The architect can use insights on operating systems and kernel development from this course to make informed decisions about system design. This course may prove helpful in learning about memory management, virtual file systems, and multitasking when designing complex software systems. The Software Architect can leverage the knowledge of kernel design patterns to create scalable and maintainable software architectures.
Database Administrator
A Database Administrator (DBA) is responsible for managing and maintaining databases. This course may prove helpful as there will be insight gained into operating systems and resource management. A DBA can apply the knowledge of memory management and file systems to optimize database performance. This course may help DBAs improve their understanding of how databases interact with the underlying operating system, leading to better performance tuning and resource allocation.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Developing a Multithreaded Kernel From Scratch!.
Provides an in-depth look at the Linux kernel architecture and implementation. It covers topics such as process scheduling, memory management, and file systems. It is valuable for understanding the design choices made in a real-world kernel. This book is more valuable as additional reading than it is as a current reference.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser