This is the archived Fall 2013 version of the course. For the most recent version, see http://rust-class.org.

Class 5: She Sells C Shells (by the Rust Shore)

PDF version of notes for printing

Action Items

You should have a teammate for PS2 by now. If you don't, hang around after class to find one.

PS2 is now posted and is due on Monday, September 30. Please be aware that it is significantly more challenging than PS1, and it is a very bad idea to delay getting started on it!

Course Philosophy

What is my goal for the lectures?

What are my academic goals for the course?

We wish to establish in the upper country of Virginia, and more centrally for the State, a University on a plan so broad and liberal and modern, as to be worth patronizing with the public support, and be a temptation to the youth of other States to come and drink of the cup of knowledge and fraternize with us. (Thomas Jefferson's letter to Joseph Priestly, 1800)

If this doesn't coincide with your personal goals, what should you do?

Thomas Jefferson enrolled in the College of William and Mary on March 25, 1760, at the age of 16... By the time he came to Williamsburg, the young scholar was proficient in the classics and able to read Greek and Latin authors in the original... He was instructed in natural philosophy (physics, metaphysics, and mathematics) and moral philosophy (rhetoric, logic, and ethics). A keen and diligent student, he displayed an avid curiosity in all fields and, according to family tradition, he frequently studied fifteen hours a day. (From Jefferson's College Life.)

What is my goal for the assignments? What should your goal be?

Some professors who want to minimize grading time have the misfortune of teaching as schools without strong honor systems like UVa. This forces them to adopt other solutions, like the "Tiger Professor" approach: Severe CS 161 syllabus provokes controversy among students (The Daily Californian, 3 September 2013)

Danny Lewin

Danny was killed on September 11. He was on American Flight 11 on his way to meetings in California when his plane was hijacked. In true Danny form, he fought back against the terrorists in an effort to defend the stewardesses and the cockpit. To this day, those of us who knew him well can’t figure out how only five terrorists managed to overpower him. During his short life, Danny made extraordinary contributions to the internet and to computer science through his work in algorithms and complexity theory. The impact of his work will be felt throughout the hi-tech industry for many years to come.

Tom Leighton's remarks naming of the STOC Best Student Paper Award in honor of the late Daniel Lewin

Links

If you are interested in using and contributing to the Rust documentation Jordi is developing, they are at http://seld.be/rustdoc/. (Note that these are targeting the latest version, so may not be entirely consistent with version 0.7, but its also fine if you want to upgrade to using the latest version.) If you are also interested in contributing to improving them (instead of competing with my daughter's efforts), visit this github page and #rustdoc-wg on irc.mozilla.org.

I am far too modest to include a link to the Prospect Magazine Article I mentioned, but if you'd like to read another article about my experience at Udacity, I'd recommend One Year Later (a blog post I wrote) or David Carr's Information Week Article.

Shell Code

use std::{io, run};

fn main() {
    static CMD_PROMPT: &'static str = "gash > ";

    loop {
        print(CMD_PROMPT);
        let line = io::stdin().read_line();
        let mut argv: ~[~str] = line.split_iter(' ').filter(|&x| x != "")
                                    .transform(|x| x.to_owned()).collect();
        if argv.len() > 0 {
            let program = argv.remove(0);
            match program {
                ~"exit"     => { return; }
                _           => { run::process_status(program, argv);}
            }
        }
    }
}

Class 4: Once Upon a Process

PDF version of notes for printing

Action Items

Assignments due: Problem Set 1 is due on Tuesday, September 10 (11:59pm).

Note: given the instructor's belief that sensible countries should have national holidays when they qualify for world cups and that the University should observe national holidays, though, in the event that the US qualifies for World Cup 2014 before 11:59pm tonight, the assignment will be accepted without penalty until 11:59pm tomorrow. Before assuming you can safely rely on this, though, you should carefully consider the US team's injury and yellow card situation, and the likelihood that you'll have to deal with a grumpy instructor if you are asking for an extension under the scenario where the team fails to win tonight.

Problem Set 2 will be posted by tomorrow and due on 24 September. For PS2, you are required to work with a partner (you can choose on your own), so try to find a partner you want to work with now. To help find a partner, you can use the Piazza teammates forum.

Processes

What is a process?

Some terminology (not really important, but you'll hear people use them):

  • Multiprogramming - program gets to run until it gets stuck, then supervisor takes over and selects another program to run.
  • Non-pre-emptive multi-tasking (sometimes called co-operative multi-tasking - program gets to run until it voluntarily gives control back to the supervisor. (Sometimes used to mean the programs are all scheduled statically to recieve a particular processing time slice.)
  • Normal (pre-emptive) multi-tasking - program gets to run until (approximately) supervisor decides its someone else's turn.

(For historical reasons, the terms and hyphenating-conventions are confusing, using "program", "task", and "process" to essentially interchangably, except that the historical term multiprogramming is different from multitasking.)

What are some consequences of the difference between non pre-emptive multi-tasking and pre-emptive multi-tasking?

How can pre-emptive multi-tasking even be possible with only one processor?

Imperious Interruptus!

How often should the kernel timer interrupt (a.k.a., "supervisor's alarm clock") go off?

What programs should be able to change the kernel timer interrupt frequency?

Who prefers the kernel timer interrupt interval to be shorter? Who prefers it to be longer?

Shell Demo

The main command we used in the shell demo is: top

Try running it on your machine (if you are running Mac OS X or Linux, probably won't work on Windows unless you have installed lots of extra stuff) to see what processes are running.

Links

Kernel Timer Frequency Challenge

I'm not certain this is completely reliable, but here's what I used to determine the kernel timer frequency for my MacBook Air: How To determine Linux Kernel Timer Interrupt Frequency

$ gcc timer.c ; ./a.out
kernel timer interrupt frequency is approx. 4016 Hz or higher

It is worth a midterm exemption (and Rust sticker!) for the first person (or team of two people) who writes an accurate kernel timer in Rust.


Pages

  • Challenges
  • Course Wrapup
  • Final Projects
  • Final Survey
  • Getting Started with Github
  • IRC
  • Problem Set 3 - Zhtta Server - Benchmarking
  • Project
  • Project Ideas
  • Problem Set 1 - zhttpto Web Server
  • Comments on PS1 Comments
  • Problem Set 1 Reference Solution
  • Problem Set 2 - The Good Auld Shell
  • Problem Set 3 - Zhtta Server
  • Page Removed
  • Schedule
  • Enrolling for Spring 2014
  • Syllabus
  • Using Materials
  • Using Rust for an Undergraduate OS Course
  • VirtualBox
  • Working on Github in cs4414