Houjun Liu

Operating Systems Index

cs111.stanford.edu

Topics

CS111 leverages CS107 experience to show operating systems and how they function.

What is an operating system

  • operating system sits between hardware and user programs
  • most importantly: manages shared resources to allow the program to run
    • CPU: gets which program to do work and for how long
    • RAM: how much memory to give to a program
    • Hard Drive

Main Events

  • concurrency: switch between processes so quickly to only use on core while concurrent access
  • memory: memory addresses are mostly scattered everywhere — everything include the lowest level including CPU uses only virtual memory, translated by the OS
  • file management
  • i/o devices
  • networking: CS144
  • security: interactions between users in a system

Main Components of the Course

  • File Systems
  • Process and Multiprocess
  • Threads
  • Virtual Memory + Paging + limits
  • Modern Technologies/Niceties

Content

filesystem

How can we design file systems to manage files on disk, and what are the tradeoffs inherent in designing them. How can we interact with the filesystem?

multiprocessing

How are programs run, how to spawn subprograms, and how they work in general?

Multithreading

How do we implement a single program within a single program, and how do we not have race conditions

trust

how do we trust software?

patterns

dispatches


An example of a good time:

void main() {
    // make pipe
    int fds[2];
    pipe(fds);

    pid_t pidp = fork();

    if (pidp == 0) {
        close(pidp[1]);
        dup2(pidp[0], STDIN_FILENO);
        close(pidp[0]);
        execvp("", ...);
        // throw-a-tantrum
        exit(1);
    }

    close(pidp[0]);

    return pidp[1];
}