# Operating Systems

TA043 · SISOP · FIUBA · https://alfonsocampodonico.com/classes/operating-systems?lang=en

> Processes, scheduling, memory, concurrency and file systems, each with a simulator to play with, plus labs in Zig and a Kubernetes track on your laptop.

How a computer runs many programs at once without them stepping on each other: the kernel and its system calls, processes and file descriptors, CPU scheduling, virtual memory, locks, file systems, and finally virtual machines, containers and Kubernetes, which are the same ideas one floor up.

Every topic has an interactive playground, and the ones from OSTEP reproduce the book's homework simulators, seed for seed, so you can check your answers. The labs are small Zig programs you build, break and extend on Linux. The Kubernetes labs run a real cluster on your laptop with kind, and each one grades itself.

Follows the 2026/2 calendar of the Operating Systems course at FIUBA. An independent project, not official course material.

## Code

- [os-playground](https://github.com/AlfonsoCampodonico/os-playground) · [zip](https://github.com/AlfonsoCampodonico/os-playground/archive/refs/heads/main.zip) · `gh repo clone AlfonsoCampodonico/os-playground`
- [os-lab](https://github.com/AlfonsoCampodonico/os-lab) · [zip](https://github.com/AlfonsoCampodonico/os-lab/archive/refs/heads/main.zip) · `gh repo clone AlfonsoCampodonico/os-lab`
- [k8s-labs](https://github.com/AlfonsoCampodonico/k8s-labs) · [zip](https://github.com/AlfonsoCampodonico/k8s-labs/archive/refs/heads/main.zip) · `gh repo clone AlfonsoCampodonico/k8s-labs`

## Lessons

### Kernel

- [Week 2: Syscalls and kernel mode](https://alfonsocampodonico.com/classes/operating-systems/syscalls.md?lang=en): Follow a write() from your program, through the trap, into the kernel and back.

### Processes

- [Week 3: fork, exec and wait](https://alfonsocampodonico.com/classes/operating-systems/fork.md?lang=en): Write a program with fork() and watch the process tree grow, zombies and orphans included.
- [Lab 1: Processes, Syscalls, and Process Trees](https://alfonsocampodonico.com/classes/operating-systems/lab-processes.md?lang=en): How does one program become many running processes, and how does the operating system keep track of them?
- [Week 4: File descriptors and pipes](https://alfonsocampodonico.com/classes/operating-systems/pipes.md?lang=en): See each process’s file descriptor table as the shell sets up ls | grep x > out.

### Scheduling

- [Week 4: CPU scheduling](https://alfonsocampodonico.com/classes/operating-systems/scheduling.md?lang=en): Load jobs, pick FIFO, SJF, STCF, RR or MLFQ and compare turnaround and response time.
- [Lab 2: Threads, Scheduling, and Synchronization](https://alfonsocampodonico.com/classes/operating-systems/lab-threads.md?lang=en): Why can the same multithreaded program produce different answers across runs?

### Memory

- [Week 6: Address translation](https://alfonsocampodonico.com/classes/operating-systems/address-translation.md?lang=en): Base and bounds, segmentation and paging: type a virtual address and watch it get translated.
- [Week 7: TLB](https://alfonsocampodonico.com/classes/operating-systems/tlb.md?lang=en): An access trace, a small TLB and a replacement policy: count hits and misses.
- [Week 7: Page replacement](https://alfonsocampodonico.com/classes/operating-systems/page-replacement.md?lang=en): FIFO, LRU, OPT and Clock on the same trace: which one has the fewest page faults?
- [Lab 3: Memory Maps, Locality, and Isolation](https://alfonsocampodonico.com/classes/operating-systems/lab-memory.md?lang=en): How does the operating system present memory as one address space while still controlling mapping, protection, and performance?

### Concurrency

- [Week 7: Race conditions and locks](https://alfonsocampodonico.com/classes/operating-systems/locks.md?lang=en): Two threads, one counter and one interleaving: watch an increment get lost and a lock fix it.

### Filesystem

- [Week 8: Filesystem: inodes and blocks](https://alfonsocampodonico.com/classes/operating-systems/filesystem.md?lang=en): A tiny disk with bitmaps, inodes and data blocks: run mkdir, creat, link and unlink.
- [Lab 4: Files, Pipes, and a Tiny Shell](https://alfonsocampodonico.com/classes/operating-systems/lab-shell.md?lang=en): How do Unix shells connect programs together with file descriptors and pipes?

### Virtualization

- [Week 12: VMs, microVMs and containers](https://alfonsocampodonico.com/classes/operating-systems/virtualization.md?lang=en): Trap-and-emulate in a VM, the boot and virtio of a microVM, and the namespaces and cgroups of a container.
- [Week 12: Kubernetes](https://alfonsocampodonico.com/classes/operating-systems/kubernetes.md?lang=en): Follow a pod from kubectl apply to Running: scheduler, kubelet, cgroups and Services.

### Kubernetes labs

- [K8s lab 00: Bootstrap](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-00-bootstrap.md?lang=en): This lab is a warm-up. By the end of it you will have a working kind cluster, a functioning kubectl, and a basic mental model of what just happened.
- [K8s lab 01: Pods & containers](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-01-pods.md?lang=en): The Pod is the atom of Kubernetes scheduling. Every other workload resource (Deployment, StatefulSet, Job, DaemonSet, …) ultimately emits Pods. Understand pods deeply and the rest of Kubernetes is much easier.
- [K8s lab 02: Deployments & ReplicaSets](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-02-deployments.md?lang=en): Pods die. Nodes die. kubectl operators fumble and delete things. If you want workloads that survive any of that you need a controller that reconciles for you.
- [K8s lab 03: Services & Ingress](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-03-services-ingress.md?lang=en): A Pod's IP is ephemeral and rebuilt on every reschedule. A Service gives a stable virtual IP and DNS name for a set of pods selected by labels. An Ingress routes external HTTP(S) traffic to those Services.
- [K8s lab 04: ConfigMaps & Secrets](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-04-config-secrets.md?lang=en): Stateless workloads still have configuration: feature flags, database URLs, TLS bundles, credentials. Kubernetes has two first-class objects for that — ConfigMaps (non-sensitive) and Secrets (sensitive).
- [K8s lab 05: Storage](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-05-storage.md?lang=en): Most interesting applications need storage that outlives a pod.
- [K8s lab 06: StatefulSets](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-06-statefulsets.md?lang=en): Deployments treat their pods as interchangeable. That is a disaster for clustered databases, queues, or any workload where pod web-0 owns shard 0, pod web-1 owns shard 1, and the two must address each other stably.
- [K8s lab 07: Jobs & CronJobs](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-07-jobs.md?lang=en): Not every workload is a long-running server. Batch processing, backups, migrations, and scheduled reports need a workload controller whose success condition is "runs to completion". That is a Job.
- [K8s lab 08: Health, resources & autoscaling](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-08-health-resources.md?lang=en): Three distinct concepts students frequently conflate: probes tell the kubelet whether a container is alive/ready/starting, resources tell the scheduler and kernel how much CPU/memory a container expects, and the HorizontalPodAutoscaler adjusts replica counts from observed metrics.
- [K8s lab 09: RBAC & security](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-09-rbac-security.md?lang=en): Every request to the API server is authenticated (who are you?), authorised (are you allowed?), and admitted (is the thing you're trying to do permitted by cluster policy?).
- [K8s lab 10: Observability & debugging](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-10-observability.md?lang=en): Production clusters fail in creative ways. Reading logs, events, and metrics is not optional; neither is having a disciplined triage routine. This lab builds that routine.
- [K8s lab 11: Helm](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-11-helm.md?lang=en): Helm packages Kubernetes manifests into charts. A chart is a directory of Go-templated YAML plus a values.yaml of defaults.
- [K8s lab 12: Capstone](https://alfonsocampodonico.com/classes/operating-systems/kubernetes-12-capstone.md?lang=en): Design, deploy, and operate a non-trivial multi-tier application on the kind cluster.
