We may earn an affiliate commission when you visit our partners.
Hussein Nasser

Operating systems orchestrate many processes, allow access to memory, disk and network and execute the process by scheduling them to the CPU. Sounds simple when we put it this way but this task is vast. So vast indeed that writing programs that are efficient really depends on how much understanding the engineer has in operating systems.

Read more

Operating systems orchestrate many processes, allow access to memory, disk and network and execute the process by scheduling them to the CPU. Sounds simple when we put it this way but this task is vast. So vast indeed that writing programs that are efficient really depends on how much understanding the engineer has in operating systems.

I have been fascinated by revealing and demystifying anything that is hidden from me, mainly because by treating black boxes as black boxes that takes input and produces output, I feel that I am at the mercy of this black box. Databases were a black box for me a decade ago, I was at completely lost when a query that I wrote was originally running fast but after few month it had gone slow. The reason is I didn't really have any understanding of database systems and how their internals work.

The same thing is true for operation systems, we run our program which turns into a process that uses bit of memory and access disk and network but we really don't know how this is done and as a result we as engineers are bound to write inefficient code.

I built this course to demystify what I believe are the fundamentals operating systems to software engineers. Like all my courses, I recommend the student having some programming experience to take this course, it just makes the course relatable. I will be using multiple operating systems like Linux, Windows and Mac in this course.

I hope you enjoy it.

Enroll now

What's inside

Learning objectives

  • Learn how operating systems work
  • Understand how applications run within the os
  • Write efficient applications leveraging the understanding os works
  • Understand the cost of system calls
  • Understand how cpu executes processes
  • The role of the kernel
  • Cpu architecture and caches
  • Virtual memory
  • Socket programming
  • Storage and file system management

Syllabus

Before we start
Welcome
Who is this course for?
Course Overview and Outline (must watch)
Read more
Course Downloadable Content
Why an OS?
Section Intro Why an OS

Most operating systems are general purpose software that link software to hardware. You don't have to use one. By the end of this course you will feel that for most of the apps we write we can use a general purpose OS like Linux or windows but sometime to be really efficient one might consider writing their own special purpose.

A lecture explaining the most critical hardware components and the OS,

CPU

Memory

Storage
Network

File System

Security

Program

Process

Kernel

Userspace

Kernel space (drivers)

System calls

The Anatomy of a Process
Anatomy of a Process Section Intro
Program vs Process

In this lecture we show an example of the main function with instruction pointer moving to the next and execute. Simple with no stack or heap


The brilliant invention of the stack,  We introduce the stack function calling another function and local variables, return address, frames

It is understanding the stack that makes us pay attention to performance, too many function calls will jump from one to another

Process Execution with Stack



We Introduce the heap with an example, place where random blobs of memory is allocated, need to access it from multiple place and manipulate it. static vars are like this, except we can change the heap. Here lies the danger when it comes to threads as two threads changing the same place.


Allocating in the heap does not guarantee memory will be contagious, so if I store A and B , If I try to read A and B it might need two memory accesses as they might be in different pages, we will learn this in the virtual memory section. Whereas in the stack all variables are next to each other and memory access might give us both at once minimizing memory accesses.


Use linux, show all processes top

run ./a.out

then run cat /proc/29404/maps

this will list all mappings, including c library lib c, (except kernel mappings)



The process components

Memory Managment
Memory Management Section Intro
  • We talk about memory, random access read and write memory, fast access volatile, DIMMs, double data read how CPU reads


We walk through the process of reading from memory, show how it must go through the CPU

We will discuss  the challenges of physical memory, we want to run many programs but we don't have enough memory contiguous should we just fail if I'm out of memory? Meet swap to disk. I have 10 programs all using libc a shared library, should I load 10 copies of the identical code or should I share them? I have 10 processes wanting to share memory.

We will talk cost of virtual memory, page tables  and is it really worth it


Internal fragmentation (memcached allocates large block but in the block lots of small space)

External fragmentation, the physical memory is available but all over the place cant even allocate a block to you

Shared memory

Isolation

Large Programs (Swap)


CPU involvement in memory reading is slow, Direct memory access allow a device to write or read directly between the device and user space as opposed to moving it from device to the register and write it back to memory

Going through Top command explain the memory list

Virtual memory

Residential

Shared


Code to allocate memory and leak, then fix it. and show memory

Memory Quiz
Inside The CPU
Inside the CPU Section Intro
  • Components

  • ALU

  • CU

  • Registers and Caches

  • Clock Speed

  • Cores

  • Pipelining

  • Parallelism

  • Architecture

  • RISC vs CISC

  • 32 bit 64 bit


uname -m to know the cpu architecture (32 or 64 bit)

cat /proc/cpuinfo



Walk through fetch an instruction, we check L1, L2, L3, if not, we get it  from memory, (64 byte cache line) put it in L3, L2 and L1i then we fetch the actual instruction to the IR (instruction register)


we then decode the instruction, covert the opcode of the instruction to actual instruction, RISC is simple, CISC takes time.  (CU)


Then we actually execute (ALU),


(optional memory read)


(write back to register)


we fetch another instruction, (cache hit L1)


Pipelining, one instruction requires many stages, fetch, decode, execute, memory access , memory write 

if we wait all stages cpu won't be doing anything, we pipeline them. The laundry example


Parallelism, multiple cores multiple processes simple

multiple cores single process, multiple threads

hyper threading or Simultaneous multi threading

- one core is represented as two logical core with logical registers (program counter etc) and caches are shared.


Inside the CPU Demo (CPU wait times)
Inside the CPU Quiz
Concurrency, Context Switching and Scheduling
Process Management Section Intro
Process vs Thread
Context Switching

We discuss how we can saturate the workload of the process and thread

Mutexes and Semphores


Show a fork() and CoW where forking creates a new process


cow.c


cat /proc/1478/smaps | grep -A 50 heap

to grab the 50 lines after heap

notice the

Shared_Clean: 0 kB

Shared_Dirty: 9692 kB

Private_Clean: 0 kB

Private_Dirty: 552 kB


When do you use threads?
Process Quiz
Storage Management
Storage Management Section Intro

Why persist?

HDD vs SSD

App -> FileSystem -> Block Layer -> NVMe Driver


File system

FAT

ext4

Page cache

Read vs Write example

File Modes

Discuss some of the file modes O_SYNC, O_DIRECT

What really happens in a file IO?
Storage management Demo
Storage Management Quiz
Socket Management
Socket Management Section Intro

Little intro on NIC/ networks, OSI model, ip , tcp, UDP

socket

connection

Accept vs SYN queue

Receive vs Send Queue

tcp_hashinfo memory for mapping connection


Sending and Receiving Data
Socket Programming Patterns

select

epoll

IOCP

kqueue

io_uring

Build a tcp server with C 

Socket Management Quiz
More OS Concepts
OS Concepts Section Intro

Compiled Language vs Interrupted

Execution File format (exe/elf)

Kernel vs User Mode switching

cgroup vs namespace

Course Summary
Bonus Content
How Google Improved Linux TCP/IP Stack by 40%
How TikTok's Bytedance improved Linux reboot
On Timeouts

Save this course

Save Fundamentals of Operating Systems 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 Fundamentals of Operating Systems with these activities:
Review Computer Architecture Fundamentals
Refresh your understanding of CPU architecture, including registers, caches, and instruction execution, to better grasp how the OS interacts with hardware.
Show steps
  • Review the basic components of a CPU.
  • Study the different levels of cache memory.
  • Understand the fetch-decode-execute cycle.
Read 'Modern Operating Systems' by Andrew S. Tanenbaum
Expand your knowledge of modern operating systems by reading a well-regarded textbook.
Show steps
  • Obtain a copy of 'Modern Operating Systems'.
  • Read the chapters relevant to the course syllabus.
  • Compare and contrast the concepts with those presented in the course.
Read 'Operating System Concepts' by Silberschatz, Galvin, and Gagne
Gain a comprehensive understanding of operating system principles by reading a classic textbook.
Show steps
  • Obtain a copy of 'Operating System Concepts'.
  • Read the chapters relevant to the course syllabus.
  • Take notes on key concepts and definitions.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Implement a Simple Scheduler
Solidify your understanding of process scheduling by implementing a basic scheduler algorithm (e.g., Round Robin or Priority Scheduling).
Show steps
  • Choose a scheduling algorithm to implement.
  • Write code to simulate process creation and execution.
  • Implement the scheduling logic.
  • Test the scheduler with different process workloads.
Create a Presentation on Virtual Memory
Deepen your knowledge of virtual memory by creating a presentation explaining its concepts, benefits, and implementation.
Show steps
  • Research virtual memory concepts and techniques.
  • Create slides outlining the key aspects of virtual memory.
  • Prepare a script or notes for the presentation.
  • Practice delivering the presentation.
Contribute to an Open Source OS Project
Gain practical experience by contributing to an open-source operating system project, such as Linux or FreeBSD.
Show steps
  • Find an open-source OS project on GitHub or GitLab.
  • Identify a bug or feature to work on.
  • Submit a pull request with your changes.
  • Respond to feedback from project maintainers.
Build a Simple File System
Reinforce your understanding of storage management by designing and implementing a basic file system.
Show steps
  • Design the file system structure (e.g., inodes, directories).
  • Implement the core file system operations (e.g., create, read, write, delete).
  • Test the file system with various file sizes and directory structures.
  • Add error handling and recovery mechanisms.

Career center

Learners who complete Fundamentals of Operating Systems will develop knowledge and skills that may be useful to these careers:
Operating Systems Engineer
An operating systems engineer focuses on the design, development, and maintenance of operating systems. This course provides a strong foundation in the fundamentals of operating systems, making it highly relevant for anyone in this role. The course includes instruction on how applications run within the OS, how the CPU executes processes, the role of the kernel, CPU architecture and caches, virtual memory, socket programming, and storage and file system management. The course should be valuable for anyone looking to deepen their understanding of operating systems.
Kernel Developer
A kernel developer works on the core of an operating system, modifying and improving the kernel to enhance performance and stability. This course helps kernel developers understand the intricacies of operating systems, including CPU execution, process management, and memory management. The lectures on virtual memory, CPU architecture, and file system management equip them with the knowledge to optimize the kernel. A kernel developer should find this course extraordinarily useful as it directly addresses kernel functions.
Systems Programmer
A systems programmer specializes in developing and maintaining operating systems, device drivers, and system utilities. This operating systems course is directly relevant as it covers the fundamentals of operating systems, including the kernel, CPU architecture, virtual memory, and file system management. The course helps systems programmers understand how applications run within the OS, enabling them to write efficient and reliable system-level code. This course directly provides an understanding of how operating systems work, a crucial skill for systems programmers.
Performance Engineer
A performance engineer analyzes and optimizes software systems to improve their efficiency and responsiveness. This operating systems course directly addresses key areas for performance optimization, such as understanding the cost of system calls, how CPU executes processes, and the impact of memory management. This course helps performance engineers identify and address bottlenecks in software by providing a deeper understanding of how the operating system interacts with applications. The instruction on CPU architecture and caches may be particularly useful to a performance engineer.
Software Engineer
A software engineer designs, develops, and tests software applications and systems. This operating systems course helps software engineers write efficient code by understanding how operating systems work, including process management, memory management, and storage management. Understanding the cost of system calls, how the CPU executes processes, and the role of the kernel helps them optimize applications. This course may be helpful to software engineers who want to write efficient code that interacts effectively with the operating system.
Site Reliability Engineer
A site reliability engineer ensures the reliability, availability, and performance of software systems. This operating systems course is directly useful, because understanding operating system internals is crucial for effective troubleshooting and optimization. The course covers process management, memory management, storage, and file system management, all vital components to ensure reliability. A site reliability engineer should find the instruction on the cost of system calls immensely useful.
Application Developer
An application developer designs, codes, and tests applications for computers and other devices. This course teaches developers to understand how applications run within the OS, how CPU executes processes, the role of the kernel, CPU architecture and caches, virtual memory, storage and file system management. This is extremely useful to application developers, and should help them improve their understanding of the software that they work with. Any application developer may find this course extremely useful.
Embedded Systems Engineer
An embedded systems engineer designs and develops software for embedded systems, like those in appliances or vehicles. This operating systems course may be useful, because embedded systems often have resource constraints, making an understanding of operating system fundamentals crucial for writing efficient code. This course covers the essentials of how applications run within the OS, how the CPU executes processes, and memory management, all critical for optimizing performance in embedded environments. This course may help one to be a more effective embedded systems engineer.
Technical Lead
A technical lead guides a team of engineers, providing technical direction and mentorship. This operating systems course may be useful for a technical lead who wants to deepen their understanding of system-level concepts, so that they may guide their team. The course covers process execution on the CPU, the role of the kernel, virtual memory, and storage, which should be useful to building a strong technical base. The course on operating systems is important because it helps technical leads make informed decisions.
Cloud Engineer
A cloud engineer is responsible for designing, building, and maintaining cloud computing infrastructure. This operating systems course may be helpful as it provides insights into how operating systems manage resources, which is crucial for optimizing cloud environments. The course covers topics such as virtual memory, storage management, and socket programming, which are all relevant to cloud infrastructure. A cloud engineer should find this course quite helpful if they want to understand how the OS interacts with cloud resources.
Network Engineer
A network engineer designs, implements, and manages network infrastructure, ensuring reliable communication between systems. This operating systems course may be useful, because understanding socket programming and network protocols can help to optimize network performance and troubleshoot network issues. The course covers socket management concepts, which are essential for network communication. By taking this course, a network engineer helps builds their understanding of low level network concepts.
DevOps Engineer
A DevOps engineer automates and streamlines the software development and deployment process. This operating systems course may be useful, as understanding operating system principles can help DevOps engineers optimize infrastructure and application performance. The course touches on areas like process management, memory management, and storage management, all important considerations in a DevOps environment. The instruction on how an OS works helps the DevOps engineer gain valuable insight.
Security Engineer
A security engineer protects computer systems and networks from threats by designing and implementing security measures. This operating systems course may be useful as it provides a deeper understanding of how operating systems work, which is essential for identifying and mitigating security vulnerabilities. The course covers topics such as kernel operations, process management, and memory management, all of which are relevant to system security. A security engineer can benefit from this course to write more secure code.
Solutions Architect
A solutions architect designs and implements complex software solutions that meet business requirements. This operating systems course addresses areas that may be useful for a solutions architect by helping them understand system resource management and performance optimization. The course covers topics such as memory management, storage, and the cost of system calls. The section on socket programming may also be relevant. This operating systems course helps the architect write efficient applications.
Database Administrator
A database administrator installs, configures, and maintains database systems, ensuring data integrity and performance. This operating systems course may be useful as understanding operating system fundamentals can help database administrators optimize database performance. The course covers topics such as memory management, storage management, and CPU architecture, all of which impact database performance. Socket programming knowledge may also be useful to enable client-server communications. For a database administrator, this course helps give a useful understanding of the underlying system.

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 Fundamentals of Operating Systems.
Comprehensive and widely used textbook on operating systems. It covers all the fundamental concepts in detail, including process management, memory management, storage management, and more. It valuable reference for understanding the theoretical underpinnings of operating systems and is commonly used in academic institutions. Reading this book will provide a solid foundation for the course.
Provides a comprehensive overview of modern operating systems, covering topics such as process management, memory management, file systems, and security. It is known for its clear explanations and practical examples. While it can be used as a reference, it is more valuable as additional reading to expand on the course material and gain a deeper understanding of the subject.

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