Date: 4/5/12

Course: CS 111 (Computer Science III - Operating Systems)
Professor: Paul Eggert
Website: http://cs.ucla.edu/classes/spring12/cs111

Pre-requisites: CS 32, 33, 35L
Recommended: CS 118, 131, 151B

    Logistics
        - Workload
            > Lecture          (4 hours/week)
            > Lab/Discussion   (2 hours/week)
            > Outside Study    (9 hours/week)
        - Midterm
            > May 3 (Thurs) in lecture
            > Open-book & Open-notes
        - Final
            > May 3 (Thurs) in lecture
            > Open-book & Open-notes
        - Labs (4)
            > Can be done in groups of two
            > Shell
            > Device Driver
            > File System
            > Internet System
        - Design Problem (1)
            > Extended version of the lab
        - Mini-Labs (2)
            > Focused aspecs of OSes
                + Write a small operating system of your own (WeensyOS)
        - Written Report (1)
            > 2-3 pages on a fture topic (TBA)
        - Scribe Notes
            > Groups of at most 4
            > Check with http://validator.w3.org to validate HTML for Scribe Notes
            > Create a tarball file that contains an "index.html" file that contains work
        - Grading
            > Labs     33%
                + Each lab is worth 1/12 of final grade
            > Exams    33%
                + Midterm is worth 1/9 of final grade
                + Final is worth 2/9 of final grade
            > Other    33%
                + Mini-Lab          1/15
                + Design Problem    1/12
                + Scribe Notes      1/12
                + Written Report    1/30
        - Deadlines
            > Scribe Notes (due 1 week after the lecture)
                + Scribe Notes for the lecture prior to the midterm is due 5 days after the lecture
            > Labs
                + As stated in the syllabus
                + Lab 1
                    * 1A    (Due April 10)
                    * 1B    (Due April 24)
                    * 1C    (Due April 27)
            > Mini-Labs
                + Mini-Lab 1    (Due April 20)
            > Written Report     (Due June 8)
            > Design Problems
                + Due 1 week after lab
        - Lateness Policy
            > 2^N points for [N, N + 1) days late
                + Assuming 100 point assignment
            > Drop-dead last day to turn-in anything: Friday (last discussion section)
        - Submission Policy
            > Collaboration about general information is permitted and encouraged
            > Code submitted must be your (or your group's) own
        - Textbook
            > Principles of Computer System Design (Saltzer & Kaashoek)
        - Virtual Machines (VM)
            > Typically use QEMU or Bochs atop own machine or SEASnet Linux server
            > Used to boot & run code for assignments
        - Language of Choice: C
    
    Project 1
        - Example Input: sort < a | cat b - | tr A-z a-z > c
                         sort -k2 d - < a | uniq -c > e
                         diff a c > f
            > Three processes are spawned for the first command and run in parallel if possible
            > When the first command is complete the second command will run followed by the third
                + Note the first and second commands are independent and can be parallelized
                + The last command must wait until the first command completes
    
    Definition of "System" (Oxford English Dictionary - 1928)
        1. An organized or connected group of objects
        2. A set of principles, etc.; a scheme, method
        - Definition hints at Object-Oriented Programming (OOP) constructs
   
     Definition of "Operating System" (Encarta - 2007)
        1. Master control program in a computer...
        - Too control oriented
    
    Definition of "Operating System" (American Heritage Dictionary - 2000)
        1. Software designed to control the hardware of a specific data processing system in order to allow users and application programs to make use of it
        - Too control oriented
        - Operating system controls both hardware and software
        - Operating systems are not always specific to certain computers
            > Generic OSes exist (e.g. Linux)
    
    Definition of "Operating System" (Wikipedia - v46980935)
        1. A set of programs that manage computer hardware resources and provide common services for application software
        - A major component of OSes is resource management
        - Common services can make programming for the platform more efficient
    
    Definition of "System" (TEXTBOOK - S1.A.2)
        1. A system is a set of interconnected components that has a specified behavior observed at the interface with its environment.
        - An interface encapsulates the system and separates it from the environment
            > Good programming principles dictate good interface design
            > Interface is the go-between for the system and environment
        - Interface Technologies
            > Network Protocols
                + Interfaces between multiple computers
            > Application Programming Interface (API)
                + Interface between programs and OS
            > Application Binary Interface (ABI)
                + Hardware rules for a specific system
            > User Interface
                + Interfaces between user and computer
            > Instruction Set
                + Lowest level interface between hardware and software
    
    Systems Nest
        - Systems are different aspects
            > Systems can be seen through different perspectives 
    
    Major OS Aspects
        - Virtualization
            > Non-real implementations of systems that are implemented via lower level physical components
            > Ex: Virtual Memory, Virtual Machines
        - Scheduling
            > The distribution of computer resources when demand for resources is greater than the amount of resources available
            > Resources
                + CPU
                + Network
                + Disk IO
        - Consistency
            > Rules for keeping applications "sane" and operating correctly
            > Synchronization
        - File Systems
            > Simplified database systems
        - SECURITY
            > Hard to implment after a system is built
            > Needs to be considered while the system is being built
    
    Problems with Computer Systems
        - Trade-offs (Waterbed Effect)
            > Optimizing for one aspect may deoptimize another apsect
        - Incommensurate Scaling
            > Not everything grows at the same rate
            > Economies of Scale
                + Things are optimized as they get large
                + Ex: Pin factory (Wealth of Nations: a. Smith)
                + Can cause resource wastage
            > Diseconomies of Scale
                + Things are disoptimized as they get large
                + Ex: Ethernet Switch
                + Can cause breakage
                    * Overload can prevent correct functionality
        - Propagation of Effects (Butterfly Effect)
            > Naturally occurs in chaotic systems
            > Backslash Problem (Windows OS)
    
    
    Homework
        - Read Sections 1-2.3