Overview

../../../../../../_images/user-kernel.svg

User Space, Kernel Space?

  • Clear distinction - separation of concerns

  • User space programs use services provided by kernel - via system calls

  • Programs (their programmers) use simple programming paradigms like blocking I/O ⟶ transparent waits

  • All heavy stuff is done by the kernel

User Space: Abstractions

  • No direct hardware access

  • Per-process linear address space

    • The Process Abstraction

    • ⟶ perception that I own all memory

    • Virtual memory - virtualization of physical memory

  • Scheduling

    • ⟶ perception that I own the CPU

    • virtualization of physical CPU

  • File systems

    • Raw disks are not organized hierarchically, obviously

    • File descriptors for open files

    • Blocking I/O

  • Networking

    • Sockets, represented by file descriptors

    • Blocking I/O

  • (Many more)

Kernel: Where The Heavy Stuff Is

  • Interrupts from hardware devices

  • Raw memory - not organized linearly

  • Multiple CPUs

  • One single address space

    • ⟶ heavy parallelism

    • Hard!!

Booting a Computer

  • Bootloader

    • Machine specific ⟶ low level

    • Hardware initialization (RAM, basics peripherals like timers)

    • Loads (and starts) the kernel - in a variety of different ways

  • Kernel

    • More hardware initialization (optional peripherals, mostly)

    • Subsystems initialization (memory management, storage, …)

    • Starts userspace ⟶ /sbin/init (usually), PID 1

  • PID 1

    • Starts “services” (sshd, graphical login screen, logging, …)

    • (Grand-) parent of all other processes