COP5641/CIS4930 Linux Kernel and Device Driver Programming

Syllabus

Summer 2008 - B Term
Instructor

Ted Baker and An-I Andy Wang

We will team-teach the course. Dr. Wang will be principally responsible for the first three weeks, and Dr. Baker will be principally responsible for the last three weeks, including the project.

(*) We will also take turns at office hours, corresponding to the days we teach. The person who teaches will be available for at least one hour after each class. We will start out by going to the lab, 016 Love. If there are no questions in the lab, we will move back to our office.

Meeting Place and Times

Regular class meetings are scheduled Monday through Friday, 12:30 PM - 1:45 PM, in room 103 of the Love Building.

In addition to the regular class meetings you will need to schedule lots of time to work on the projects in the lab (room 106 Love), and times to meet with the instructor and demonstrate your work for each assignment.

How much time you spend in the lab will depend strongly on how many errors you make. Typically, an error in kernel programming will require that you reboot the system before you can continue.

Description

Survey of the design and internal organization of the Linux kernel, from the viewpoint of kernel modules and device drivers. Students will be expected to do programming projects involving modifications to the kernel source code, probably the code of a device driver.

This course is intended for advanced undergraduate students and graduate students.

A few of the students who have taken this course have gone on to jobs working for OS or hardware vendors, doing device driver and kernel programming. However, broader benefits of the course include:

In addition, a personal objective of the instructors for this course is that students finishing it will be adequately prepareed for individual research projects (honor's thesis, master's project/thesis, Ph.D. dissertation) that require kernel-level programming. We especially hope students may be interested in our own research on device driver architecture, real-time systems, RAID storage systems, and multiprocessor scheduling.

Some details will need to be worked out as the course progresses. The principal question is which hardware you will use for the final project. We still have the cameras and frame grabbers used in prior years, and there are still improvements that can be made in the driver for the frame grabber. However, it would be better to work on some new devices. Present candidates include some USB and firewire video cameras and network (Ethernet) drivers. This will be settled before the end of the third week of classes. If you have an idea or preference about a particular device you would like to work on, please contact the instructor during the first week or two of classes.

You will need to have root access to a computer on which you can load Linux for this course. We will provide access to such computers in the 016 Love lab. However, if you have a computer of your own you will also have the option of doing the individual assignments on your own machine, provided you are willing and able to bring the machine in to demonstrate the working assignments. For the team assignments, using the video gear, it will probably only be practical to work in the lab.

A problem with all summer B term courses is pacing. The class meets every day for six weeks. This does not provide much time for thinking and programming. In order to complete a meaningful programming project in six weeks we will need to survey the background material (covered in the text) very quickly, and then focus on the project.

There will be several individual programming exercises, followed by one (larger) team project. The team project will be a new or modified device driver. SIf we again work on video frame grabbers we will be limited by the number of devices. We own six frame grabbers and six cameras, which means we can have up to six teams, of 2-3 people per team working on these devices.

Prerequisites

Students are expected to be familiar with using the Unix/Linux operating system' shell commands and C programming language API, as well as general principles of operating system functions, organization, data structures, and algorithms at the level covered in our undergraduate course in operating systems, COP4610. Students who have not taken COP4610 or COP5570 (Advanced Unix Programming) should contact the instructor to find out whether they have adequate preparation.

Objectives

In order to pass this course, you will need to demonstrate that you have learned to:

Topics

See the table of contents of the textbook (below) for a list of topics. We will probably cover about 2/3 of the book.

Textbook

Authors: Jonathan Corbet, Allessandro Rubini & Greg Kroah-Hartman

Title: Linux Device Drivers, 3rd Edition

Publisher: O'Reilly

ISBN 0-596-00590-3

http://www.lwn.net/Kernel/LDD3

Since there is a free PDF copy on line, and commercial printed copies are available very cheap, I did not order this book with the FSU bookstore. I recommend you order a copy on line. From Amazon.com it is less than $27 (new). You can still download the free PDF copy and print it, but even printed double-sided it is much bulkier than the commercial printing. Just don't use any of the CS Department printers to print out your own hard copy version. Violators of this rule, if caught, will have their departmental computer usage privileges suspended.

Table of Contents:

Table of Contents
Preface
Chapter 1: An Introduction to Device Drivers
Chapter 2: Building and Running Modules
Chapter 3: Char Drivers
Chapter 4: Debugging Techniques
Chapter 5: Concurrency and Race Conditions
Chapter 6: Advanced Char Driver Operations
Chapter 7: Time, Delays, and Deferred Work
Chapter 8: Allocating Memory
Chapter 9: Communicating with Hardware
Chapter 10: Interrupt Handling
Chapter 11: Data Types in the Kernel
Chapter 12: PCI Drivers
Chapter 13: USB Drivers
Chapter 14: The Linux Device Model
Chapter 15: Memory Mapping and DMA
Chapter 16: Block Drivers
Chapter 14: Network Drivers
Chapter 14: TTY Drivers
Bibliography
Index

Links to other on-line references, including outline notes and examples covered in class, will be provided during the term.

Assignments

Readings.You will be assigned readings in the textbook and the Linux operating system source code.

Class Participation. The study of much of Computer Science is cumulative (i.e., understanding earlier material well is necessary to grasp later material. That is very true in this course. Do not allow yourself to fall behind, by postponing studying, and then figure you will jump ahead to catch up with the rest of the class.

You are expected to attend class. Experience has shown a high correlation between absenteeism and low grades. Absences will be excused for the reasons listed in the University Attendance Policy, which are "documented illness, deaths in the immediate family and other documented crises, call to active military duty or jury duty, religious holy days, and official University activities". Consideration will also be given to "students whose dependent children experience serious illness". It is your responsibility to make arrangments with the instructor for accomodations, and if you know in advance of an event that will require your absence you are responsible for making arrangments in advance of the event.

Quizzes. Due to the nature of the subject and the shortness of the 6-week summer term, there will be no final examination in this class. Instead, there will be several short quizzes. The quizzes will test your grasp of readings, material covered in the classroom, and the programming assignments you have done, and serve as a check on attendance. They may have a single question, or several. Likely dates are indicated on the calendar, but you should be prepared for a surprize quiz on any day. There will ordinarily be no make-ups for missed quizzes. If just one quiz is missed for an excused absences or lateness, the quiz average for that student will simply be computed based on the quizzes given on the other dates. If more than one quizz is missed arrangments will be worked out on a case-by-case basis.

Programming Assignments. There will be several homework assignments, involving programming in the Linux operating system kernel. The objectives of the assignments will be to give you practice working with the ideas and techniques you are learning in class. Details of the assignments will be announced as the term progresses. They will start out very simple and get progressively more difficult. The first three assignments are required to be done individually. They will be "cookbook" exercises, working up from just compiling and running code that you are given, in the text, with a few modifications. The last assignment should be original, and will be done by teams. (Each individual will be required to evaluate in writing the contribution of the other team members, and this will be taken into account by the instructor in the assignment of individual grades for the project.)

To do your homework assignments you will be provided access to a PC in a department-run laboratory. Since the kind of programming you will be doing may corrupt the operating system installation, you will need to learn how to install (and reinstall) the operating system. You will also be responsible for backing up your work on another system, which you can do using tar and sftp. Since the number of computers that the department can dedicate to this course is limited, the enrollment in the course will be limited by the number of students who can be served by our lab facilities.

The programming assignments for this course can be very time consuming, depending on how good a programmer you are (more precisely, the degree to which you code things right the first time, versus relying on the test-and-fix method). Debugging kernel code goes much slower than debugging application code, because after every failed test you generally will need to reboot the system. It usually takes several minutes for the system to reboot and restore consistency to the filesystem. Debugging kernel code is also more time consuming because when the system crashes you don't get much information about where an error occurred.

You may be able to do some of the work for the assignments of this course on your personal computer, but beware of the following:

More information on the programming assignments will be given out each week, and posted on the Web.

Grading

Every piece of graded work will be assigned a score in the range 0 to 100. At the end of the term these numeric grades will be averaged to compute your final grade for the term, using the following table:
PercentLetter
91- 100A  [4.00]
89-90A- [3.75]
85-88B+ [3.25]
PercentLetter
81-84B  [3.00]
79-80B- [2.75]
75-78C+ [2.25]
PercentLetter
71-74C  [2.00]
69-70C- [1.75]
64-68D+ [1.25]
PercentLetter
61-63D  [1.00]
59-60D- [0.75]
0- 58F  [0.00]

The following are the items that will be graded, and the weights they will be given:

ItemWeight
Program 1 (Individual)10
Program 2 (Individual)15
Program 3 (Individual)15
Program 4 (Team Project & Report)30
Quizzes30

Do not expect tolerance or forgiveness for lateness during a Summer B term (six week) course. There just is not enough time.

Academic Honor Policy

The Florida State University Academic Honor Policy outlines the University's expectations for the integrity of students' academic work, the procedures for resolving alleged violations of those expectations, and the rights and responsibilities of students and faculty members throughout the process. Students are responsible for reading the Academic Honor Policy and for living up to their pledge to "...be honest and truthful and ... [to] strive for personal and institutional integrity at Florida State University." (Florida State University Academic Honor Policy, found at http://dof.fsu.edu/honorpolicy.htm.)

Take note that this policy not only puts you on your honor not to cheat. It requires that you report any cheating that you observe. In this course, the academic penalty for first violation will be a zero on the assignment or examination where the violation occurred, and the penalty for repeat violations will result in a grade of "F" in the course. Please read the detailed discussion of how the Honor Code applies to programming assignments, at http://www.cs.fsu.edu/~baker/plagiarism.html.

Accommodation for Disabilities

Students with disabilities needing academic accommodations should:

  1. Register with and provide documentation to the Student Disability Resource Center (SDRC).
  2. Bring a letter to the Instructor from the SDRC indicating the need for accommodatoin and what type. This should be done during the first week of class.

This syllabus and other class materials are available in alternative format upon request.

For more information about services available to FSU students with disabilities, contact the Assistant Dean of Students at:

Student Disability Resource Center
97 Woodward AVe. South
108 Student Services Building
Florida State University
Tallahassee, FL 32306-4167

e-mail: sdrc@admin.fsu.edu
phone: (850) 644-9566.

Communication

If you are experiencing difficulty or are concerned about your progress, please contact the Instructor right away. Problems are usually easier to solve when they are addressed early, and in a six-week summer course there is no time to catch up.

You are required to verify that your e-mail address is included in the class e-mail list. The Instructor will send everyone a message at the start of the term. If you don't get that first message, make sure you are added to the list.

Please check daily for electronic mail sent to you containing information about this course. You are also encouraged to use e-mail to ask questions and report problems, but:

  1. Use the telephone if you want a quick answer. During the work week, response time may be 24 hours or more. I may not read e-mail at all on a typical weekend.
  2. Take care to use an appropriate subject line in any e-mail you send to the instructor, to make it stand out among the "spam". I generally delete, without reading, anything whose sender and subject link do not look like university business.

All e-mail correspondence relating to this course should be via an FSU e-mail account. That means you should not expect a reply, for example, if your e-mail is sent from a Yahoo or Hotmail account. Likewise, you should not accept as valid any e-mail purporting to be from the instructor unless it comes from the instructor's "cs.fsu.edu" e-mail address.

© 2003-2008 T. P. Baker ($Id)