OS Internals - CS 572/Winter 2009               Bart Massey/Jim Binkley


Class time:      Tu/Th 17:15-18:30
Classroom:       CH 324
Office/s:        FAB 120-14 (Jim),  FAB 120-18 (Bart)
Email:           Jim Binkley: jrb@cs.pdx.edu
                 Bart Massey, Bart@cs.pdx.edu
Office hours:    Jim Binkley,  Tu 3-5
                 or by appointment.  Feel free to make an appointment
                 via email.
                 Bart: by email appointment
class home page: http://www.cs.pdx.edu/~jrb/ui.html
class wiki page: http://wiki.cs.pdx.edu/cs572
mail list:       mailman list - join via the following web page please:

psu calendar:    http://www.pdx.edu/registration/calendar#2009-2010
h1n1 info:       http://www.shac.pdx.edu


        Linux Device Drivers.  Corbet, Rubini, Kroah-Hartman.
        3rd Edition. ISBN 0-596-00590-3.  Feb. 2004.
        See http://www.oreilly.com for more information.

Note: you must have the 3rd edition.

     Understanding the Linux Kernel.  Daniel P. Bovet and
        Marco Cesati.  3rd Edition. ISBN-10: 0596005652,
        ISBN-13: 978-0596005658,  O'Reilly Media, Inc.,
        November 2005.

Students must...
  - be familiar with the functions of a modern multiuser
    operating system (equivalent to what is learned in CS333 or CS 533),
    serious UNIX knowledge is a must too.
  - be GOOD if not excellent with C.
  - have the ability to send Internet e-mail to the address above.

                        Class Overview
The class this quarter intends to go on a technological adventure.
View this as a trip into the jungle with Jim Binkley (first half of class)
and Bart Massey (second half) as your safari leaders.

We are going to learn about linux device drivers courtesy of the ORA
Linux kernel book.  Our lectures will for the most part be based
on the book and the code examples presented in the book.  Jim
will lead the class during the 1st half of the quarter (up to the midterm).
Bart will take over after the midterm.  As time permits, class material will
include:  intro to UNIX operating systems, kernel layout, an intro to device
drivers, linux modules, various kinds of device drivers including character
and network, tasking, time, and synchronization in an SMP environment, Linux
kernel memory and hardware management, interrupts, and buses.  We also
hope that one or two local Linux kernel gurus will be nice enough to come
and give us a talk about topics related to the linux kernel during class.
There will be at least two programming assignments done as individuals
or small teams, both aimed at loadable module projects.  Students
will be expected to use the 2.6 kernel. Lab machines will be available
for those who need a machine to torture.  There will be a few more
details on the assignments below.  The first assignment is actually
more or less -- download a distribution of some sort (Jim will use
ubuntu), and learn how to recompile the kernel.

IMPORTANT: please bring your device driver book to class every session.
We will often refer to it in class and look at various code examples and pictures.

            Calendar (will slip, if necessary)

This is a very rough calendar and it may be wrong in terms of lecture material.
The rough idea is that we will go through the book in order, barring 2 changes:

                1. moving network drivers up just after character devices.
                2. going over the kernel layout early in the class

When                    What                            Assignments
----                    ----                            -----------
classes begin Sept 28, first session Sept 29

Sept 29/Oct 1           intro/modules                   A1 out Oct 1
Oct 6/8                 char devices, network devices
Oct 13/15               debugging
Oct 20/22               catchup
        Jim will be away on the 22 - Bart will teach
Oct 27/29               more char device, time
Nov 3/5                 midterm on the 3                A1 in at midterm,
                                                        A2 out on the 5th
Nov 10/12               memory and hw management
Nov 17/19               interrupt handling
Nov 24                  usb, device model
Nov 26                  thanksgiving holiday
Dec 1/3                 block device drivers            A2 in on Dec 11
Dec 7-12                final exam week
                        final exam Dec 8 17:30-19:20

Calendar 2009:


 S  M Tu  W Th  F  S
27 28 29 30

         Oct                    Nov                    Dec
 S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
             1  2  3    1  2  3  4  5  6  7          1  2  3  4  5
 4  5  6  7  8  9 10    8  9 10 11 12 13 14    6  7  8  9 10 11 12
11 12 13 14 15 16 17   15 16 17 18 19 20 21   13 14 15 16 17 18 19
18 19 20 21 22 23 24   22 23 24 25 26 27 28   20 21 22 23 24 25 26
25 26 27 28 29 30 31   29 30                  27 28 29 30 31

                     Programming Assignment

We will do the first assignment as individuals but you are allowed
to talk to other students about it.  The second assignment will
be more open and we may use a team approach.  You may be assigned
a box n the netlab or you may use your own.

The two assignments will be to develop loadable kernel modules.

1. a1, write a character device driver that writes a structure into
the kernel and then reads it out.  statistics should be available
for i/o for this device from a /proc device structure.

2. a2, As a possible assignment assume we will use the
Intel CPU timing mechanisms exist which are called cycle counting
registers to measure some aspect of kernel behavior.  We will
build a logging module and then try to determine what takes time
in the life of a packet. The instructors would be interested
in developing a measurement project that measures how efficient
the "packet socket" queue is in the Linux kernel.  We would like
to see how much time it takes for a packet to move from the kernel
NIC driver into application memory.  Typically the packet socket
is used with applications like tcpdump which actually uses the
libpcap library available at www.tcpdump.org to do the read.
We know that the linux mechanism is much less efficient than the FreeBSD
mechanism in this regard.  It would be good to see if we could
figure out exactly why it is less efficient.

It is possible that you may negotiate some other project with
the instructors especially for a2 or for a1 for that matter.
Good ideas will be entertained.  Bart may have a hardware assignment
by the time we get to a2 (after the midterm).  We may actually
have several possible assignments for a2.


Midterm                                 150
Final                                   150
In class contributions                  100
Programming Assignment/s
A1                                      200
A2                                      400

More points may be awarded for outstanding
in class contributions.

Regarding "In class contributions":

The class is considered a seminar.  Students are expected
to be actively engaged, to ask questions, and to help the
instructors get things straight as we go along.

Exploration is a team activity.  While the instructors
may lead the way, if anyone fails to contribute their
insights and skills the chances of the whole party
getting lost and coming to a bad end increase
dramatically.  If you show up late or not at all,
consistently fail to bring the text to class, or never
ask a single question, we'll throw you to the wolves for
the common good.

If you do something that violates the University's or the
Department's Student Conduct code, we will impose the
most severe penalties we can manage. In particular, if
you plagiarize (use other people's ideas, text, or code
without acknowledgment) we will do what we legally and
ethically can to end your academic career. If you have
questions, please contact us for clarification.

                    Initial Assignment

1. Use the World Wide Web and take a look at the class
home page (under construction) for the class; i.e.,
and the wiki page

2. subscribe to the class email mailing list.  We will have
details about that at the first class.