UNIX v6

Required reading: Chapter 6, and Chapter 7-1 through 7-4 of Lion's, and corresponding code.

Overview

  • UNIX 6th edition (for first half of the term):

    Newer UNIXs have inherited many of the conceptual ideas even though they added paging, networking, graphics, etc.

    You will need to read most of the source code multiple times. Your goal is to explain every line to yourself without using the commentary. Read it one or multiple times with Lion's commentary until you reach the goal.

    Address spaces

    Case study (Lions's book)

    In today's lecture we see how v6 creates the kernel address spaces, first user address spaces, and switches to it. To understand how this happens, we need to understand in detail the state on the stack---this may be surprising, but thread switching and address space creation are tightly bundled in v6, in a concept called process. We will study thread management in detail next week, but we will need to understand some to follow the creation and switching to the first address space. (In future lectures we will return in more detail to creating, growing/shrinking, and switching address spaces.)

    C calling conventions

    PDP-11 assembly (8 general register, pc (r7), sp (r6), environment (r5)). r0, r1 used for results

    Booting v6 (chapter 6)

    Lines 612 through 0669 set up the kernel address space. These lines are explained by Lions in Chapter 6, but the accompanying picture may be helpful, since it depicts the end result. The MMU registers of the PDP-11 may also be helpful.

    The first user-level address space

    We simplify the stack layout a bit and ignore the precise layout as described above and ignore the allocation of local variables.