Introduction (Chapter 2)

Von Nuemann’s Model of Computing

  1. Fetch (the next instruction)
  2. Decode it
  3. Execute it
  4. Repeat if more instructions

The Operating System

  • Software with the primary goal of making the system easy to use
  • Sometimes referred to as a virtual machine, for reasons made clear below.

Virtualization

  • The general technique by which the OS achieves its primary goal
  • Involves turning physical resources (such as the processor) into a more general, powerful, and easy-to-use virtual form of itself.
  • Allows many programs to run seemingly concurrently

System Calls

  • The API (interface) provided by the OS that users use to tell the OS what to do (i.e., run programs, access memory and devices, etc.)
  • Also part of what is sometimes referred to as the standard library provided by the OS

Resource Management

  • The OS is sometimes known as a resource manager, as it has to handle delegating resources to different programs.

Virtualizing the CPU (2.1)

The OS presents the user with the illusion that the running system has several CPUs, when in fact it has far fewer. This is known as virtualizing the CPU.

Policy

  • Answers the question “What should run?” when multiple programs are running at once.

Virtualizing Memory (2.2)

Physical memory is just an array of bytes. Reading memory require specifying an **address* to be able to access the data stored there. Writing (or updating) memory requires specifying the data to be written to a given address.

Physical memory is a shared resource, allocated to each process by the OS.

Programs keep their data structures in memory (e.g., through loads and stores instructions).

  • Each process accesses its own private (virtual) address space, which the OS somehow maps onto the physical memory.
  • A memory reference wishin one running program does not affect the address space of other processes.
  • The programs thinks it has the physical memory all to itself.

Concurrency (2.3)

  • Refers to problems that arise and must be addressed when working on many things at once in the same program.
  • The OS itself has to tackle the issues of concurrency because of virtualization.

Thread

  • A “function” running within the same memory space as other functions, with more than one of them active at a time.

Atomic

  • When multiple operations happen all at once.
  • This is required when working with threads.

Persistance (2.4)

When it loses power, DRAM and other memory devises lose their data. Thus, the problem of persistence is important for crucial data that the users care about. The solution is two-tiered, software and hardware

I/O (Input/Output)

  • The hardware side of the solution.
  • Includes interacting with hard drives and solid-state drives, where long-term data is stored.

File system

  • The software side
  • Stores files the user creates in a reliable and efficient manner on the disks of the system.

Unlike memory and CPU, disk space is not virtualized by the OS; each program interacts with the same disk space.

This is because it is assumed that users will want to share information that is in files between programs (vim, python, etc.)

write(), open(), and close()

  • these are system calls that programs use to have the OS interact with the disk.
  • these calls are “expensive”, in that the OS performs some ugly stuff to get everything working.
  • For speed, the system incorporates some intricate write protocol, such as journaling or copy-on-write.

Design Goals (2.5)

Maximizing Performance

  • AKA minimizing the overheads of the OS.
  • Overheads come in many forms:
    • Extra time (more instructions)
    • Extra space (in memory or on disk).

Providing Protection between Applications

  • The OS isolates processes from one another.

Reliability

  • The OS should not fail, as other programs are dependent on it.

Other goals

  • Energy-efficiency
  • Security
  • Mobility