COMP 3511: Lecture 3

Date: 2024-10-02 02:10:47

Reviewed:

Topic / Chapter:

summary

❓Questions

Notes

Storage / IO
  • Cache levels

    01_cache_level

    • range of timescales

      nametime (ns)
      L1 cache reference0.5
      branch mispredict5
      L2 cache reference7
      mutex lock/unlock25
      main memory reference100
      compress 1K bytes w/ Zippy3,000
      send 2K bytes w/ 1 Gbps net20,000
      read 1 MB sequentially from memory250,000
      round trip within same data center500,000
      disk seek10,000,000
      read 1 MB sequentially from disk20,000,000
      send packet CA->Netherlands->CA150,000,000
  • IO subsystem

    • OS: accommodate wide variety of devices
      • w/ different capabilities, control-bit def., protocol to interact
    • OS: enables standard, uniform way of interaction w/ IO
      • involving abstraction, encapsulation, and software layering
    • encapsulate device behavior in generic classes
      • each: accessed through interface: standardized set of functions
    • one purpose of OS: hide gap between hardware devices from users
      • abstraction & encapsulation!
    • IO subsystem: responsible for
      • memory management of IO
        • buffering: storing data temporarily while being transferred
        • caching: storing parts of data in faster storage for performance
        • spooling: overlapping / queuing of one job's output as input of other jobs
          • typically: printers
      • general device-driver interface
      • driver for specific hardware devices
  • Direct memory access

    • programmed IO: CPU running special IO instructions
      • moving byte one-by-one
      • between memory & slow devices (keyboard & mouse)
    • for fast devices: programmed IO must be avoided
      • instead, use direct memory access (DMA) controller
      • idea: let IO device and memory transfer data directly
        • bypass CPU!
      • CPU / OS initialize DMA controller, and it's now responsible for moving data
    • benefit: CPU freed from slow IO operations
    • OS writes DMA command block into memory
      • preparation
        • source & destination addresses
        • read || write mode
        • no. of bytes to be transferred
      • execution
        • write location of command block to DMA controller
        • bus mastering of DMA controller
          • i.e. grab bus from CPA
      • send interrupt to CPU for signaling completion
    DMA transfer diagram

    02_dma_transfer

Processors
  • Single processor system

    • traditionally: most system w/ single processor, single CPU, single processing core
      • core: executes instructions & registers for storing data locally
      • processing core / CPU: capable of executing a general-purpose instruction set
    • such systems: w/ other special-purpose processors
      • e.g. device-specific processors (for disk) and graphic controllers (GPU)
      • those: w/ limited instruction set
        • not executing instructions from user processes
  • Multiprocessor system

    • modern computer (mobile to servers): dominated by multiprocessors system
      • traditionally: 2+ processors and each w/ single-core CPU
      • speedup ratio: less than no. of processors
        • due to overhead - contention for shared resources
        • e.g. bus / memory
    • multiprocessor advantage
      • increased throughput: more computing capability
      • economy of scale: share other devices (e.g. IO devices)
      • increased reliability: graceful degradation / fault tolerance
    • two types of multiprocessor systems
      • asymmetric multiprocessing
        • master-slave manner
        • master processor: assign specific tasks to slaves
          • master: handles IO
      • symmetric multiprocessing
        • each processor: performs all tasks
          • including OS functions & user processes
        • aka SMP
        • each processor: w/ own set of registers and private || local cache
          • but all processors: share physical memory via system bus
        • 03_smp_diagram
    • multicore: multiple computing cores inside a single physical chip
      • faster intra-chip communication than inter-chip
      • using significantly less power: important for mobile / laptops
      • 04_multicore_diagram
  • Non-Uniform Memory Access (NUMA)

    • 05_numa_diagram
    • adding more CPU to multiprocessor: may not scale / help
      • as system bus can be a bottleneck
    • alternative: provide each CPU local memory
      • accessed via small & fast local bus
    • CPUs: connected by shared system interconnect
      • all CPU: share one physical memory address space
    • such approach: non-uniform memory access (NUMA)
    • potential drawback
      • increased latency when CPU must access remote memory across system interconnect
        • e.g. memory of another CPU?
      • scheduling & memory management implication
  • Computer system component

    • CPU: hardware executing instructions
    • processor: physical chip containing one or more CPUs
    • core: basic computation unit of CPU
      • or: component executing instructions / registers for storing data locally
    • multicore: including multiple computing cores on a single physical processor chip
    • multiprocessor system: including multiple processors
OS Structure
  • OS structure

    • 2 common characteristics exist in all modern OS
    • multiprogramming: for efficiency
      • aka batch system
      • single program: can't keep CPU & I/O busy
        • thus multi-program: organize multiple jobs
        • s.t. CPU will not stay idle
      • in mainframe PC: jobs being submitted remotely & queued
        • selected & ran via jab scheduling: load into the memory
    • timesharing: logical extension of multiprogramming
      • aka multitasking
      • CPU: switches frequently between jobs
        • s.t. users: can interact w/ each job while running
        • enables: interactive computing
      • characteristics
        • response time:
        • each user: w/ at least one program executing in memory (= process)
        • if several jobs ready to run: CPU scheduling needed
        • if: processes don't fit in memory
          • swapping technique required
          • moving some program in and out of memory during execution
        • virtual memory: allows execution of processes that are not completely in memory
Virtualization
  • Virtualization

    • virtualization: abstracts hardware of a single computer
      • into multiple different execution environments
        • creating illusion: each user / program is running on their "private computer"
        • creates: virtual system = virtual machine (VM) to run OS / applications over
          • allows: an OS to run as an app within another OS
            • 👨‍🏫 growing industry!
    • components
      • host: underlying hardware system
      • virtual machine manager (VMM): creates & runs VM by providing interface
        • s.t. it's identical to the host
        • aka hypervisor
      • guest: process provided w/ virtual copy of host
        • i.e. program. often: an OS (guest OS)
    • allows: a single physical machine to run multiple OS concurrently
      • each on their own VM
    system models

    _virtualization_model

  • Virtualization history

    • virtualization: OS natively compiled for CPU, running guest OSes
      • originally: designed in IBM mainframes (1972)
        • for: allowing multiple users to run tasks concurrently
          • under: system designed for a single use
        • or: sharing batch-oriented system
      • VMware: runs one or more guest copies of Windows on Intel x86 CPU
      • virtual machine manager (VMM): provides environment for programs
        • that is: essentially identical to original machine (interface)
      • programs on such environment: only experience minor performance decrease (due to extra layers)
      • VMM: in complete control of system resources
    • by late 1990s: Intel CPUs on general purpose PCs: fast enough for virtualization
      • technology: treated by , which are still relevant today
      • virtualization: expended to many OSes, CPUs, VMMs