COP5641/CIS4930 Linux Kernel and Device Driver Programming


Summer 2010 - B Term


Ted Baker and Andy Wang

Ted Baker
Office: 207A Love Building
Office hours: after class and by appointment
Phone: 644-5452
Andy Wang
Office: 264 Love Building
Office hours: after class and by appointment
Phone: 645-1562

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

Lectures are Monday through Friday, 12:30 PM - 1:45 PM, in room 301.

In addition to the lectures, you will need to schedule lots of time to work on the projects in the lab ( 016 LOV), and times to meet with the instructor and demonstrate your work for each assignment. You should plan on spending several hours per day on this course, outside of class. The exact amount will depend on your level of experience and programming skill.


This course surveys 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.

Some 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, another objective for this course is that students finishing it will be adequately prepareed for research projects that require kernel-level programming. Our research sometimes involves instrumentation and performance improvements to device drivers, and possibly to other kernel components such as scheduler, networking, and filesystems. Several other members of the CS faculty have similar interests.

This is an evolving course, so some details will need to be worked out as the course progresses. Principal among such details is the team project that you will do in the second three weeks of the course. This is normally a kernel module, typically a device driver, though some students have also done projects in other parts of the Linux kernel, such as a scheduler, a filesystem modification, or an intrusion detection system. If you do a device driver, you will need a hardware device to drive. We still have the cameras and video frame grabbers used in prior years, and there is still room for improvements to the device drivers developed by students in prior terms. However, in may be more interesting to look at some new devices. Possible candidates include low-cost USB video cameras and network (Ethernet) drivers. One student has expressed interest in working on the Google phone platform.

Team groups and project proposals will need to be approved before the end of the third week of classes. So, 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 Love 016 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, depending on what hardware devices you use, it may only be practical to work in the lab.

One problem with summer B term courses is pacing. They meet 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 the larger (team) project mentioned above.


Students coming into this course need to be already familiar with the Unix/Linux operating system, including the shell commands and the C programming language API, as well as general principles of operating system functions, organization, data structures, and algorithms at the level covered in COP 4610. Therefore, the formal prerequisite for this course is COP 4610 Operating Systems and Concurrent Programming. COP 5570 Advanced Unix Programming is also accepted. Students who have not taken either of these courses, but believe they may have adequate preparation from other sources, may request permission from the instructor.


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

Textbooks & Topics

Title: Writing Linux Device Drivers: A Guide with Exercises
Author: Jerry Cooperstein
Publisher: Jerry Cooperstein
ISBN 978-1448672387
Hard copy available from, electronic copy available for download from several other sites.
Title: Linux Device Drivers, 3rd Edition
Authors: Jonathan Corbet, Allessandro Rubini & Greg Kroah-Hartman
Publisher: O'Reilly
ISBN 0-596-00590-3

You are required to obtain your own copy of each book, and read them. Cooperstein's is the only up-to-date book on the subject. Corbet's book is several years behind on changes to the Linux kernel, but it is better written than the Cooperstein book. Therefore, the lectures will tend to follow the Corbet organization, with updated content from the Cooperstein book.

If you decide you want a hard copy of either book, order it. Do not use any of the CS Department printers to print out your own hard copy version from the electronic one. Violators of this rule, if caught, will have their departmental computer usage privileges suspended. (Besides, you will not like what you get if you print out a copy. I printed out a pre-print of Corbet's book once that way and did not like it. It was so happy when I finally got a copy of the printed version.)

Table of Contents:

Table of Contents
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

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

Attendance & Other Class Participation

The content of this course is cumulative and very compressed. Do not allow yourself to fall behind, expecting to be able to catch up later.

Experience has shown a high correlation between absenteeism and low grades. Therefore, students are required to attend all class meetings. Your final grade will be reduced by one percent for each unexcused missed class. Lateness will count as half a class. Excused absences include documented illness, deaths in the family and other documented crises, call to active military duty or jury duty, religious holy days, and official University activities.


You will be assigned readings in the textbook and the Linux operating system source code, on which quizzes will be given.


Due to the shortness of the 6-week summer term, there will be no final examination. Instead, there will be several quizzes. The quizzes will test your grasp of readings, material covered in the classroom, and the programming assignments you have done. They may have multiple questions, and they will generally not be announced in advance. On the average, you should expect about one quiz per week. If a quiz covers material you are required to know to do a programming assignment the credit for the programming assignment will be contingent on satisfactory performance on the quiz.

Programming Assignments.

There will be several homework assignments, involving programming in the Linux kernel. The objectives of the assignments will be to give you practice working with the ideas and techniques you are learning about in class. Details of the assignments will be announced as the term progresses. They will start out simple and get exponentially 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: 016 Love. 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. Since the number of computers that the department can dedicate to this course is limited, the enrollment in the course will be limited to the number of students who can be served by our lab facilities, plus the number of students who can provide their own computer facilities for use in the course.

BEWARE The assignments for this course can be very time consuming. 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 minutes to reboot and restore consistency to the filesystem. Debugging kernel code is difficult because when the system crashes you don't get much information about where an error occurred.

You may be able to do some or all 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.


Your final grade will be computed using the follwing table:

91- 100A  [4.00]
89-90A- [3.75]
85-88B+ [3.25]
81-84B  [3.00]
79-80B- [2.75]
75-78C+ [2.25]
71-74C  [2.00]
69-70C- [1.75]
64-68D+ [1.25]
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:

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

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 " honest and truthful and ... [to] strive for personal and institutional integrity at Florida State University." (Florida State University Academic Honor Policy, found at

You are required to read this policy and abide by it. Note that not only puts you on your honor not to cheat but also requires that you report any cheating you may observe. Each violation will result in a negative score on the assignment or exam, equal to the entire value of the assignment. That is, if the assignment is worth 10 points, the penalty for cheating will be a score of -10 points (not zero). This is intended to make the penalty for cheating greater than the penalty for doing no work at all. Please read the detailed discussion of how the Honor Code applies at

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 accommodation 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
874 Traditions Way
108 Student Services Building
Florida State University
Tallahassee, FL 32306-4167
phone: (850) 644-8504.


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. The instructors 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 either of the instructors, to make it stand out among the "spam". We generally delete, without reading, anything whose sender and subject link do not look like university business.
  3. To ensure a reply, send e-mail from your FSU or FSU CS e-mail account. E-mail from outside ISP's is sometimes caught by "block hole" filtering, or may not be recognized by the instructor as coming from you if the e-mail username is differnt from you own name.
T. P. Baker and An-I Wang ($Id)