Operating system basics
This course explains what an operating system does and how it supports a Rails application. It covers the kernel, user mode and system calls, then processes, fork, exec, copy-on-write and signals. It moves on to threads, concurrency, Ruby's GVL and mutexes, followed by virtual memory, the stack and heap, and garbage collection. Later lessons cover inodes, file descriptors, permissions, blocking and non-blocking I/O, buffering and pipes. The last lesson maps each concept to Puma, database connection pools, log rotation and Docker containers.
What you'll learn
- ✓The kernel, user mode and system calls
- ✓Processes, fork, exec, copy-on-write and signals
- ✓Threads, the GVL, race conditions and mutexes
- ✓Virtual memory, stack, heap and Ruby garbage collection
- ✓Inodes, file descriptors, permissions and I/O multiplexing
- ✓How Puma, database connections and Docker rely on these concepts
What is an operating system?
Every time you run bin/rails server, something manages the thousands of details required to make it work: allocating RAM for Ruby objects, scheduling CPU time between your server and your Spotify playlist, reading files from disk, and routing network packets from the browser to Puma.
Read the full lesson free →Curriculum
7 lessonsWhat is an operating system?
Defines the operating system, its five jobs, the kernel, system calls, the boot process and the Unix philosophy.
Processes: programs in action
Explains processes, PIDs and states, fork and exec, copy-on-write in Puma, zombies, signals and environment variables.
Threads and concurrency
Compares threads with processes, separates concurrency from parallelism, and covers the GVL, race conditions, mutexes and Ractors.
Memory management
Covers virtual memory, pages and page faults, stack versus heap, Ruby's heap slots and its garbage collector.
The filesystem
Describes inodes, hard links and symlinks, file descriptors, permissions, journaling and how Rails uses the filesystem.
I/O and the kernel
Explains user and kernel space, system calls, blocking and non-blocking I/O, epoll, buffering, fsync and pipes.
The OS and your Rails app
Maps each concept to a Rails app: Puma workers, connection pools, signals, log rotation, permissions and Docker.