Linux Kernel Programming
January 14, 2002
Yongguang Zhang
Read Me First
- Everything is in the Web
- Syllabus, lecture notes, reading materials, projects,
- http://www.cs.utexas.edu/users/ygz/378-02S
- Just listen and participate, need not take notes
Who Am I?
- Yongguang Zhang
- Ph.D. in Computer Sciences, 1994, Purdue
- 3rd semester in UT
- Taught 2 grad courses in UTCS
- 4th undergrad courses
- 2 in Purdue-CS, 1 in UCLA-CS
- 1994-2000: Senior Research Scientist at HRL
- Doing basic research for Boeing/Raytheon/GM
- My web site: http://www.cs.utexas.edu/users/ygz
Your TA
- Benjamin C. Hardekopf
- Almost 10 years of experience in Linux
- Will help your learning and grade your projects
- E-mail: benh@cs.utexas.edu
What is this Course About?
- Linux Kernel Programming
- How to work in an example modern OS kernel
- Positioned as the laboratory component in the CS undergrad OS curriculum
- Taken after CS372 (Introduction to OS)
- Comparison to CS372
- CS372: concepts and principles of an OS
- CS378: an example of how they are actually done
What Are We Going to Learn?
- Understanding linux kernel structure
- Know how the kernel works
- Know how to customize kernel
- Writing kernel code
- Experience developing code for OS kernel
- System programming skill
- Ability to deal with large, complex systems.
- Very different from application programming (e.g., using Java)
Why Take This Course?
- Linux is increasingly important -- it is a good skill to have
- You want to become a system programmer
- You want to find a job as a system programmer
- You want to go to graduate school and do systems research
What is This Course NOT for?
- How to use Linux
- You are CS seniors, you should have known by now
- If not, there are lots of books and online resources
- Still no? there are dummy books and training courses
- How to program in Linux
- Linux certificates
- Those are for technicians
- You are a science student from a top-10 CS department, you don't
want those kind of jobs
Prerequisite
- CS372 (introduction to OS)
- CS372: concepts and principles of an OS
- CS378: an example of how they are actually done
- Taking CS372 and CS378 together?
- Possible, but discouraged
- Need to be very initiative and be prepared to spend a lot more time
- Will UTCS repeat this course?
Course Structure
- Hands-on, Project-oriented
- Lots of programming assignments (9 totals)
- You learn by doing the projects and consulting the books (textbook,
references, online resource)
- No exam
- Lectures
- Cover the basics and overview parts of Linux kernel
- Not possible to cover everything in depth
- There will be guest lectures too (by Linux Gurus from industry)
Projects
- 3 Individual Assignments (week 2-4)
- One per week, on basic topics of Linux kernel (that everyone should
know)
- 5 Group Projects (week 5-9)
- Each cover different part of the kernel
- 8 projects will be announced before week 4
- You pick 5 out of 8 projects, and do one per week
- You can change groups for each project
- 1 Final Project (week 11-15)
The Final Project
- A larger project to put all your skills in use
- On an interesting topic, may have practical value, may make contribution
to Linux community
- Project list (and group size) will be announced after week 4
- You form a group and pick a project
- Opportunity to do projects with IBM Linux Technology Center
- Many final projects are suggested by IBM LTC
- You can work with mentors from IBM LTC
Lectures
- Part-I: First 4 weeks
- The basics of Linux kernel
- Part-II: Week 5-11
- Overview of different parts of the kernel
- May not cover everything in depth (you will learn them through your
projects)
- Part-III: Week 12-14
- Special topics, guest lectures, etc.
Student Strategy
- Part-I: Master the basics
- Part-II: Come to the lecture and learn the basics
- Part-II: Learn the details through projects
- Start from the project description
- Identify the parts of kernel that the project covers
- Learn those parts by reading the textbook yourself
- Use what your learn in the project
- Bring your questions to class
- Part-III: See above
Example Bad Strategies
- Read the textbook from page 1 to page 684
- This is not a reading class
- Attempt to memorize the code
- In system programming, the skill is more important
- It is good to know the code, but only through practice
- Skip the lectures
- You can learn the parts of kernel that your choice of projects does
not cover during lectures
- Attendance counts as 20% of your grade
Expectation from You
- You work hard (approximately 10 hours/week)
- You take initiatives
- You learn the details by yourself
- Don't wait till the last minute to start your project
- You work well with your teammate
- Or you may have no one to work with for next project
- Everything in Linux
- No project, document written with MS Windows
Grades
- 20% Class participation (not just attendance)
- 80% Projects:
- 3 individual assignments: 18% (6% each)
- 5 group projects: 30% (6% each)
Course Matters
- Class Meeting Time: Mon/Fri 11:00am-12:30pm
- Professor Office Hour: Mon/Fri 2:30pm-3:30pm
- Other time please make appointment by e-mail (ygz@cs.utexas.edu)
- TA Office Hour: TBA
- Questions about your projects, Linux kernel: see your TA first
Course Matters
- Textbooks:
- Understanding the Linux Kernel
- Kernel Projects for Linux
- Reference books: ask me
- Online resources
- A good start: www.linux.org, www.kernel.org
Course Matters
- Newsgroup
- CS Accounts
- Linux hosts
Today's Short Topics
- Linux history
- System programming
Modern Operating Systems
- Architecture
- Kernel: OS core running in privileged mode
- User-space: compiler, editor, GUI, ..., system and application programs
- Unix
- Many flavors (most not "free")
What is Linux
- Full featured, Unix-like OS
- Open source: entire kernel source available free
- Community: created by a loose worldwide community of programmers collaborating
mainly through the internet
- Portable from mainframe to hand-helds
- Estimated users: over 18 millions (counter.li.org)
GNU: Open Source before Linux
- The concept of "free" software
- Through 70s: Richard Stallman advocates "free" software
- "free" as in freedom (not zero cost):
- free to use, distribute (for a profit), and modify
- 1984: Richard Stallman founded GNU
- Goal: to produce free software.
- GPL: ensure software freedom by copyright terms
- GNU software: Unix-like programs (no kernel)
Linux Right on the Start
- 1991: Finnish student Linus Torvalds started working on update of
Minix
- From early start, Linus asked for volunteers on the Internet to help
him develop Linux
- People started using and publicizing Linux
- A number of programmers joined the project
- From the start, the source code has been freely available on the Internet
- GNU has lots of user-space programs but no kernel
Linux Kernel Evolution
- 0 (Apr 1991): First e-mail from Linus
- 0.01 (Sept 1991)
- 1.0 (March 94), user: 100,000
- 1.2 (March 95), user: 500,000
- 2.0 (June 96), user: 1,500,000
- 2.2 (January 99)
- 2.4 (January 2001)
- Odd/Even versioning system
- 2.5.x: development kernels
Systems Programming
- What is System Programming?
- Dealing with large complex and usually monolithic system software
(e.g., OS kernel)
- Why large, complex, and monolithic software?
- Structure often limits flexibility and performance
- Working such system requires extraordinary skill
- It is often an art more than a science or an engineering
- In industry
- System programmers usually have more "respect" than application
programmers
Today's Homework
- Read Chapter One before coming to class Friday
- Practice using Linux (if you are not familiar with it already)
- Book-marking the course website.
Next Class
- Linux kernel structure
- User-Mode-Linux
- Give you first programming assignment (due next Friday)
Acknowledgement
- This course is in part supported from a grant from IBM Linux Technology
Center (Austin)
© 2002 Yongguang Zhang