Linux Kernel & Device Driver Programming

COP5641 Spring 2013

[Home] [Syllabus] [Calendar] [Class Code] [Assignments] [References] [Final Projects]

Syllabus


Spring 2013


Instructors

Instructor: Dr. Sarah Diesburg
Office: 105-A Love Building
Office hours: after class and by appointment
E-mail: diesburg [at] cs.fsu.edu
TA: Bobby Roy
Office: 105-E Love Building
Office hours: after class and by appointment
E-mail: roy [at] cs.fsu.edu

We will take turns being available for at least one hour after each class. We will start out by going to the lab. If there are no questions in the lab, we will move back to our office.


Meeting Place and Times

Lectures are weekly, Tuesday an Thursday, 9:30 AM - 10:45 AM, in room 301.

In addition to the lectures, you will need to schedule lots of time to work on the projects in the lab (LOV 016), 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.


Description

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 half 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.

Team groups and project proposals will need to be approved by the deadline stated in the calendar. 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. 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.

There will be several individual programming exercises, followed by the larger (team) project mentioned above.


Prerequisites

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.


Objectives

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


Textbooks & Topics

Title: Linux Kernel Development (3rd Edition)
Author: Robert Love
Publisher: Addison-Wesley Professional
ISBN 978-0672329463
Hard copy available from Amazon.com.
Title: Linux Device Drivers, 3rd Edition
Authors: Jonathan Corbet, Allessandro Rubini & Greg Kroah-Hartman
Publisher: O'Reilly
ISBN 0-596-00590-3
http://www.lwn.net/Kernel/LDD3

You are required to obtain your own copy of each book, and read them. Love'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 in terms of Linux drivers and projects. Therefore, the lectures will tend to follow the Corbet organization, with updated content from the Love 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.)

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.


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.


Readings

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


Quizzes

Due to the programming-intensive nature of the course, 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. 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.


Grading

Your final grade will be computed using the follwing table:

PercentLetter
91- 100A
89-90A-
85-88B+
PercentLetter
81-84B
79-80B-
75-78C+
PercentLetter
71-74C
69-70C-
64-68D+
PercentLetter
61-63D
59-60D-
0- 58F

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

ItemWeight
Assignment 1 (Individual)10
Assignment 2 (Probably Individual)5
Assignment 3 (Individual)15
Assignment 4 (Individual)15
Assignment 5 (Team Project & Report)30
Quizzes25

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.)

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 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 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
e-mail: sdrc@admin.fsu.edu
phone: (850) 644-8504.


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.

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 office hours or ask directly after class 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.