Lecture 10: OS Overview and xv6

What was your first OS?

Looking Back…

Remember at the beginning: OS

OS and the Architecture/HW

Brief History of OSs (on PCs)

How to Build an OS?

Kernel architectures

There are three common kernel architecture types:

  1. Monolithic Kernels
          Kernel Space                    User space
+-------------------------------+   +------------------+
| Mem Man                       |   |                  |
| Scheduler                     |   |                  |
| File Sys         System API <-------> User programs  |
| Device drivers                |   |                  |
| Program loader                |   |                  |
| . . .                         |   |                  |
+-------------------------------+   +------------------+
  1. Microkernels
      Kernel space                     User space
+---------------------+   +----------------------------------+
| Mem Man             |   | +-> File System <--> Disk Driver |
| Scheduling          |   | |                                |
| Interproces Comms <-------+-> Program 1                    |
|                     |   | |                                |
+---------------------+   | +-> Program 2                    |
                          +----------------------------------+
  1. Hybrids (?)

Booting up and Bootloaders

  1. Press the power button
  2. Motherboard powers up and starts executing the BIOS (Basic Input/Output System)
  3. BIOS: loads user settings from a volatile memory on the MB (backed by a small battery)
  4. BIOS: some basic checks on the hardware and initialization
  5. Initialize the bootstrap sequence

What is the MBR?

Bootloader

Let’s look at a small example OS: xv6

xv6


Let’s do a quick tour!!

Can be browsed easily at https://github.com/mit-pdos/xv6-public.

  1. bootasm.S - the boot sector!
  2. bootmain.c - loads the kernel binary from disk
  3. main.c - the entry to the OS
  4. proc.c - contains the scheduler

Let’s download, compile, and run xv6!

See Installation Instructions