- 最后登录
- 2013-4-6
- 在线时间
- 4172 小时
- 寄托币
- 48275
- 声望
- 3110
- 注册时间
- 2003-9-1
- 阅读权限
- 175
- 帖子
- 1491
- 精华
- 44
- 积分
- 114817
- UID
- 143979
   
- 声望
- 3110
- 寄托币
- 48275
- 注册时间
- 2003-9-1
- 精华
- 44
- 帖子
- 1491
|
发表于 2009-6-30 02:12:59
|显示全部楼层
Original link: http://www.cs.usfca.edu/~cruse/cs635/
CS 635: Advanced Systems Programming (Fall 2007)(NOTE: 635表明是研究生课程。老美课程一般都是3个数字,第一个数字代表是为了哪个年级开的,比如 1XX就是给1年级上的,2xx给2年级。6xx就是研究生了)
[size=+1]Lecture: Tuesday-Thursday 7:30pm-9:15pm (235 Harney Science Center)[size=+1]Instructor:[size=+1]Allan Cruse
cruse@usfca.edu
Phone: (415) 422-6562
Office: 212 Harney Science Center
Office Hours: (see my homepage)
[size=+1]Synopsis:
- Focuses on Open Source Linux operating system for Intel x86-family processors kernel version 2.6.22
- Assumes familiarity with C/C++ programming language,x86 machine architecture, Unix operating
system commands,and standard data-structures and algorithms (e.g., CS 112/210/245/326) - Open to USF Graduate Students (and to qualified undergraduates or non-degree students with instructor permission)
[size=+1]List of planned course topics:- Loadable kernel modules
- Shared runtime libraries
- Thread and memory management
- Asynchronous input/output
- The '/proc' and 'ext2' filesystems
- Character and Block Device-Drivers
- System data-structures and algorithms
- Kernel threads, timers, and wait-queues
- Interrupts, Exceptions, and System-Calls
- IA32 Symmetric Multiprocessing architecture
The course includes lectures, readings, discussions, demonstrations and programming projects.
[size=+1]Course Textbooks: [size=+1]Learning Outcomes:- You will be able to read and write code-modules for an operating system
- You will be able to implement customized extensions to the Linux kernel
- You will be able to craft your own tools that let users control their PC
- You will be able to identify system features that impact performance
[size=+2]Resources
[size=+2]Readings
- For Tue, Aug 28: Linux Device Drivers: Chapter 1 "An Introduction to Device Drivers" and Chapter 2: "Building and Running Modules"
- For Thu, Aug 30: Understanding the Linux Kernel: Preface and Chapter 1 "Introduction"
- For Tue, Sep 04: Linux Device Drivers: Chapter 3 "Char Drivers"
- For Thu, Sep 06: Understanding the Linux Kernel: Chapter 2 "Memory Addressing"
- For Tue, Sep 11: Linux Device Drivers: Chapter 4 "Debugging Techniques"
- For Thu, Sep 13: Understanding the Linux Kernel: Chapter 3 "Processes"
- For Tue, Sep 18: Linux Device Drivers: Chapter 5 "Concurency and Race Conditions"
- For Thu, Sep 20: Understanding the Linux Kernel: Chapter 5 "Kernel Synchronization"
- For Tue, Sep 25: No new reading assignment: submit completed programming project #1.
- For Thu, Sep 27: Understanding the Linux Kernel: Chapter 4 "Interrupts and Exceptions"
- For Tue, Oct 02: No new reading assignment: review for Midterm Exam I.
- For Thu, Oct 04: Understanding the Linux Kernel: Chapter 8 "Memory Management"
- For Tue, Oct 09: Linux Device Drivers: Chapter 8 "Allocating Memory"
- For Thu, Oct 11: Read three sections in PC16550D Serial UART: "General Description", "Features", and "Registers"
and browse The Serial UART online tutorial by Lammert Bies - For Tue, Oct 16: Linux Device Drivers: Chapter 6 "Advanced Char Driver Operations"
- For Thu, Oct 18: Linux Device Drivers: Chapter 7 "Time, Delays, and Deferred Work"
- For Tue, Oct 23: No new reading assignment: submit completed programming project #2.
- For Thu, Oct 25: Understanding the Linux Kernel: Chapter 6 "Timing Measurements"
- For Tue, Oct 30: Linux Device Drivers: Chapter 9 "Communicating with Hardware"
- For Thu, Nov 01: Linux Device Drivers: Chapter 12 "PCI Drivers"
- For Tue, Nov 06: Understanding the Linux Kernel: Chapter 7 "Process Scheduling"
- For Thu, Nov 08: PCIe GbE Controllers Open Source Software Developer's Manual (.pdf format):
Read Chapter 1: "Introduction" and Chapter 14: "General Initialization and Reset Operation" - For Tue, Nov 13: PCIe GbE Controllers Open Source Software Developer's Manual (.pdf format):
Read Chapter 3: "Receive and Transmit Descriptors" - For Thu, Nov 15: No new reading assignment: review for Midterm Exam II.
- For Tue, Nov 20: Understanding the Linux Kernel: Chapter 9 "Process Address Space"
- For Thu, Nov 22:No new reading assignment: University holiday (Thanksgiving recess)
- For Tue, Nov 27: Understanding the Linux Kernel: Chapter 10 "System Calls"
- For Thu, Nov 29: Understanding the Linux Kernel: Chapter 10 "Interrupt Handling"
- For Tue, Dec 04: No new reading assignment: review for Final Examination.
[size=+2]Systems Software- Utility program: mmake.cpp(a tool you can use for compiling Linux 2.6 kernel modules)
- Development tool: newmod.cppbuilds skeleton C code for a new Linux Kernel Module
- Development tool: newinfo.cppbuilds the skeleton for an LKM that creates a '/proc' file -- obsoleted by kernel 2.6.26
- Development tool: newproc.cppreplacement for the obsolete 'newinfo.cpp' utility above -- posted on 07/17/2008
- Device-driver: dram.cneeded to allow reading from your workstation's physical memory -- revised on 02/06/2008
- Utility program: fileview.cpp(a navigation tool for viewing the contents of binary files)
- Utility program: setconsole.cpp(a tool for redirecting your 'printk()' console messages)
- Utility program: dump.cpp(a tool that displays the contents of any file in hex and ascii)
- Utility program: ljpages.cpp(a tool that submits your program source to a laser printer)
- Utility program: iopl3.cpp(a tool by Alex Fedosov that lets user-programs do direct I/O) -- revised on 10/13/2007
- Utility program: liveview.cpp(enhancement of 'fileview' for viewing volatile device-files)
[size=+2]Handouts
- Quick course-preview: intro635.ppt(PowerPoint Slides)
- 0203-635-01: Course syllabus(.PDF)
- lesson1.ppt (PowerPoint Slides)
- Demo program: hello.cillustrates a minimal application-program, written in the C language
- Kernel module: kello.cmodifies the 'hello.c' program, so it becomes a Linux kernel module
- lesson2.ppt (PowerPoint Slides)
- Demo program: mycat.cshows how you could implement your own emulation for the 'cat' command
- Kernel module: cmos.cshows how to create a pseudo-file that will display some device information -- revised on 11/30/2007
- Kernel module: moreinfo.cshows how '/proc' files can be designed to display a lot more information
- lesson3.ppt (PowerPoint Slides)
- Kernel module: tempcdev.cshows how a kernel module can create a temporary device special file -- revised on 9/03/2007
- Kernel module: seesetfs.cto clarify the effect of the misleadingly-named 'set_fs()' macro-statement
- Demo program: devtfix.cppit clarifies what 'dev_t' parameter-value to use in a 'mknod()' system-call
- lesson4.ppt (PowerPoint Slides)
- Demo program: elfcheck.cppillustrating use of standard file-I/O library functions by a user program
- Kernel module: cmosram.cshowing the implementation for a simple character-mode device-driver
- lesson5.ppt (PowerPoint Slides)
- Kernel module: tasklist.ccreates a pseudo-file that will show a list of all the system's active tasks
- lesson6.ppt (PowerPoint Slides)
- Demo module: stash.cillustrates the use of 'sleeping' and 'waking' in a character device-driver
- lesson7.ppt (PowerPoint Slides)
- Demo program: concur1.cppshowing why thread-synchronization is needed in multiprogramming
- Demo program: concur2.cpprevises 'concur1.cpp' so it incorporate the use of 'mutual exclusion'
- Demo program: yielding.cppdemonstrates the 'nanosleep' system-call in Linux multiprogramming
- Demo program: concur3.cpprevises 'concur2.cpp' so it uses 'nanosleep' to reduce 'busy-waiting'
- Demo module: newstash.cuses kernel semaphores to remove 'race conditions' observed in 'stash.c'
- lesson8.ppt (PowerPoint Slides) -- corrected 'cmpxchg' (slide 20) on 9/19/2007
- Demo program: showgdt.cppshows the CPU's Global Descriptor Table (if our 'dram.ko' is installed)
- Code-fragment: cmosread.asma commented disassembly of the kernel's 'rtc_cmos_read()' function
- Student-contributed tool: findFunction.sh(automates the dissassembly of a specified kernel-function)
- lesson9.ppt (PowerPoint Slides)
- Exercise solution: cmpxchg.cpp(to illustrate the effect of the 'cmpxchg' instruction upon the ZF-flag)
- lesson10.ppt (PowerPoint Slides)
- Demo program: showidt.cppshows the CPU's Interrupt Descriptor Table (if our 'dram.ko' is installed)
- Demo module: smpinfo.cshows the MP Configuration Table and Base Configuration Table's entries
- Demo module: ioapic.clets users view the current register-values in the memory-mapped I/O APIC -- revised on 9/26/2007
- lesson11.ppt (PowerPoint Slides)
- Demo module: ioremap.cfor illustrating effects of the kernel's 'ioremap()' and 'iounmap()' functions
- Exercise solution: delaysix.cppshowing one possible way to perform the desired six-second delay
- lesson12.ppt (PowerPoint Slides)
- Demo module: pgdir.cfor providing a visualization of the current task's 'mapped' memory regions
- Demo module: cr3.ccreates a pseudo-file showing current values held in registers CR3 and CR4
- Demo module: mm.ccreates a pseudo-file showing information from a task's 'mm_struct' object
- Demo module: vma.ccreates a pseudo-file that shows a task's list of 'vm_area_struct' objects
- Demo program: domalloc.cppexamines the effect of 'malloc()' on a task's kernel data-structures
- Demo program: dofork.cppexamines the effect of 'fork()' on the list of 'vm_area_struct' objects
- lesson13.ppt (PowerPoint Slides)
- Demo program: testuart.cppuses 'loopback' mode to illustrate programming of the serial UART
- Demo program: loopback.cppshowing how a UART could support interprocess communication
- Demo programs: uartecho.cpp and trycable.cpp for checking that your null-modem cable works
- lesson14.ppt (PowerPoint Slides)
- Demo module: uartintr.cprovides an example of an interrupt-handler written for the serial-UART
- lesson15.ppt (PowerPoint Slides)
- Demo module: vram.cthis device-driver provides user-mode access to the video display memory
- Demo program: rotation.cppuses 'vram.c' to perform rotation of (red,green,blue) color-components
- Demo program: inherit.cppdemonstrates inheritance of a parent's memory-map by a child-process
- lesson16.ppt (PowerPoint Slides)
- Demo module: baudrate.cshows the implementation of an 'ioctl()' method in a Linux device-driver
- Demo program: setbaud.cppallows users to query or modify the serial-UART's current baud-rate -- revised on 10/21/2007
- lesson17.ppt (PowerPoint Slides)
- Demo module: tasklet.cillustrates use of a Linux 'tasklet' for doing bottom-half interrupt handling
- Working example: myserial.cshows a possible solution to the assigned programming project #2
- lesson18.ppt (PowerPoint Slides)
- Demo module: foo.ca very simple device-driver that lets application programs read 'jiffies_64'
- Demo program: watchfoo.cppa program that continually displays the current 'jiffies_64' value
- Demo module: timedfoo.cthis driver uses a kernel timer to curtail the frequency of 'read()' calls
- Demo module: trytimer.cillustrating how a kernel module might utilize a dynamic kernel timer
- Demo module: trymacro.cillustrating use of 'sizeof' and 'offsetof', plus the 'container_of()' macro
- Demo module: tryworkq.cillustrating the use of a 'workqueue' for scheduling some future action
- Demo module: announce.cshows how a kernel module can display its messages in a window
- Demo module: defermsg.cuses a workqueue to delay a message's appearance for ten seconds
- lesson19.ppt (PowerPoint Slides)
- Demo program: pciprobe.cppshows how software can enumerate a system's PCI device-functions
- Demo module: utsname.cshows how a module can find out the name of the node it is running on
- Demo module: tigon3.cshows our network interface's MAC-address and PCI configuration space
- Exercise solution: anchor.cmodifies 'tigon3.c' so it performs the same function on Intel 82573L nic
- lesson20.ppt (PowerPoint Slides)
- Demo program: noncanon.cppshows how applications can enable 'noncanonical' keyboard input
- Demo program: mapwatch.cppgives a dynamic visualization of current 'permanent' kernel-maps
- Demo module: pkmaps.ccreates the two pseudo-files required by our 'mapwatch' program above
- Demo program: smpwatch.cppshows a real-time display of dual-CPU interrupt-activity under Linux
- Kernel module: smpwatch.cthis driver is required when running our Linux 'smpwatch.cpp' application
- lesson21.ppt (PowerPoint Slides)
- Demo module: gbstatus.cit allows users to see the Intel 82573L controller's Device Status register
- Developer tool: igbe.c to aid with debugging of a device-driver for Intel's GigaBit Ethernet controller
- lesson22.ppt (PowerPoint Slides)
- Demo module: tryreset.cperforms an experiment with the 'reset' capabilities of the 82573L controller
- lesson23.ppt (PowerPoint Slides)
- Demo module: seereset.cshows the sequence of register state-changes during 'reset' of the 82573L
- Kernel module: setupnic.cperforms a system administration chore needed by a 82573L device-driver
- Shell script: setupnic it willaccelerate our attempts at loading the foregoing 'setupnic.ko' kernel-object
- Database template: ethersfor translating from Ethernet-address to Hostname on our 'anchor' cluster
- Kernel module: audio.cshowing one possible way of answering Question V on our Midterm Exam II
- lesson24.ppt (PowerPoint Slides)
- Kernel module: xmit1000.csupports writing a message to our '/dev/nic' device-file via Intel's 82573L -- revised on 11/24/2007
- lesson25.ppt (PowerPoint Slides)
- Kernel module: recv1000.creceives packets sent by our 'xmit1000.c' driver via Intel's 82573L nic
- lesson26.ppt (PowerPoint Slides)
- Kernel module: nic.ccombines 'write()' and 'read()' from previous 82573L drivers, and adds 'ioctl()'
- Demo program: sendto.cppuses 'ethers' lookup and 'ioct()' call to send packets to a specific node
- lesson27.ppt (PowerPoint Slides)
- Demo program: syswrite.cppshows how applications can issue a system-call directly to the kernel
- Demo module: myexport.c this module can 'export' the address of the kernel's 'sys_call_table[]' array
- Shell script: myscriptautomates the address-lookup and module-installation steps for 'myexport.ko'
- Demo module: newcall.c replaces the code for an obsolete system-call with our own kernel function
- Demo program: try17.cppthis program can be used for testing our new system-call implementation
- Exercise solution: unused.ccreates a pseudo-file that lists all the obsolete system-call ID-numbers
[size=+2]Announcements
- Enrolled students may join the class mailing-list here
- project 1: Due 7:30pm Tuesday, 25 September 2007
- Midterm Exam I: Tuesday, October 2
- project 2: Due 7:30pm Tuesday, 23 October 2007
- Midterm Exam II: Thursday, November 15
- FINAL EXAMINATION: Tuesday, 11 December 2007, 7:30pm
- ADDENDUM POSTED 17 JULY 2008: My thanks to Parag Nemade for alerting me to the fact that
the Linux kernel developers have now removed support for the older 'create_proc_info_entry()'
inferface, used in about two dozen of ourdemo-modules above, beginning with kernel version
2.6.26 (just released). Simplest 'fix' is just to substitute the 'create_proc_read_entry()' interface
in place of 'create_proc_info_entry()'; this involves editing about four lines of source-code in
each such module-example. See the LDD3 course-textbook, pages 84-86, for complete details
[as well as our newly-posted 'newproc.cpp' utility under Systems Software above].
PS:一学期上2,3门这样的课还是可以学到很多东西的,不过也有点辛苦,呵呵 |
|