engineering.wustl.edu

E81 CSE 422S: Operating Systems Organization

Fall 2021

Acknowledgement: portions of this web site and the course materials linked from it have been derived (with permission) directly from materials that were originally developed and taught at Washington University by David Ferry in the spring semester of 2016 and subsequently revised and extended by Chris Gill, Brian Kocoloski, James Orr, and Marion Sudvarg.


Instructors James Orr (Office Hours by appointment.)
Teaching Assistants Diva Harsoor (Office hours Thursdays 1:00pm-3:00pm on Zoom)
William Gozlan (Office hours Tuesdays 2:30pm-4:30pm in Urbauer 216)
Bingxin Liu (Office hours Fridays 2:00pm-4:00pm in Urbauer 216)
Course Web Site http://www.cse.wustl.edu/~james.orr/courses/cse422
Piazza Page https://piazza.com/wustl/fall2021/cse422s/home

Course Meetings

The regularly scheduled class meetings (Mondays and Wednesdays 8:30am - 9:50am) will begin with a lecture and discussions, and the remaining time will be assisted group work on studios and/or labs.

Students will be expected to keep up on the readings and lectures, to use Piazza and other course resources, and (if necessary) to attend sufficient office hours each week, in order to be able to understand and apply the technical material in the course, to ask and get answers to questions about the material, to prepare for the exams, and to get help debugging studio and lab assignments. Each student is responsible for determining how much engagement in each of those modes is needed for them to learn and perform effectively in the course.

Students should also please read and follow Washington University's COVID-19 Health and Safety Protocols and other related policies.

Exam 1
Monday, Oct 18th
Exam 2
Wednesday, Dec 8th
Prerequisites CSE 361S (or graduate student standing) and C/C++ programming experience are strictly required
CSE 332S/504N is encouraged but not required

Contents
  1. Course Description
  2. Prerequisites
  3. Discussions/Studios
  4. Lab Projects
  5. FAQ/Tips
  6. Computers, Textbooks, and Other Resources
  7. Grading
  8. Academic Support
  9. Title IX, Diversity, and Inclusion
  10. Academic Integrity

Course Description

This course intends to give hands-on experience working with the Linux operating system kernel, and covering a breadth of basic operating systems issues. The course will emphasize developing and applying skills and techniques for profiling, quantifying, and evaluating operating system behaviors based on an understanding of the policies and mechanisms that govern those behaviors.

The objectives of this course are for each student to:

This is a hands-on 400-level course dealing with complex system behaviors, using off-the-shelf platforms and software. Hiccups are to be expected, and finding previously unknown flaws in (or improvements to) the course exercises is encouraged, as the instructors pursue ongoing refinement of the content and scope of this course.


Prerequisites

The following are firm prerequisites:

The following are recommended but not required:


Discussions and Studios

This course is conducted in a studio format, both to emphasize the practical and hands-on nature of "kernel hacking" and to engage students in applied active learning exercises. The focus of lecture components is to facilitate in-class discussion of kernel design and features, while the focus of studio exercises is (1) to offer direct experience working with (and within) the kernel and (2) to familiarize students with key tools and techniques for using, profiling, analyzing, and extending kernel features. Studios and the labs may be completed in groups of up to 3 students, and are submitted for credit.

Most class periods are accompanied by additional assigned readings (and possibly additional suggested readings that may be useful). The Linux kernel is notable in that many of the discussions (and disagreements) among the original developers have been saved verbatim in repositories such as the the Linux Kernel Mailing List (LKML) or documented by firsthand witnesses at sites such as lwn.net. The course textbooks can be used as technical references for kernel mechanisms, and the suggested supplemental readings can be used to understand particular design choices affecting the Linux kernel.

The course schedule is as follows. If any changes are made to this schedule, students will be notified both in class and through e-mail, and will be given enough advance notice so that rescheduling readings and other preparation can be accommodated readily.

`
# Date Topic Readings/Resources Studio/Lab
1 Mon, Aug 30th Academic Integrity
Introduction to Linux
LKD chapters 1-2
A Brief Overview of the Linux Source Tree
Building the Linux kernel
2 Wed, Sep 1st Setting up the Raspberry Pi 3 LPI chapters 1-3 Setting up the Raspberry Pi 3 B+
Mon, Sep 6th: Labor Day Holiday - no classes
3 Wed, Sep 8th Program execution, linking, layout LPI chapters 24.1-24.2, 27.1-27.2
LKD pp. 29-32 and 38-40 (chapter 3 from Process Context through Forking, and then The Dilemma of the Parentless Task)
The inside story on shared libraries and dynamic loading
Read these man pages (opened when you run these commands) on a Linux machine:
man 3 fork
man 3 exec
man 1 ldd
man 1 nm
man 1 readelf
man 1 pmap
Program Execution and Debugging
4 Mon, Sep 13th How and when does the kernel run? LKD chapter 5
Userspace / Kernelspace API Split
System Call Source Code Pointers
Creating a syscall
5 Wed, Sep 15th Structure and infrastructure of the Linux kernel LKD chapter 6 and pp. 338-348 (chapter 17 Modules through Exported Symbols)
A simplified IDR API
Writing a kernel module
6 Mon, Sep 20th Time sources and timing
Guest Lecturer: Marion Sudvarg
LKD chapter 11
LPI chapter 23.1-23.6.6
Description of the Timer Wheel System
High Resolution Timers Subsystem
hrtimer Patch (Formerly ktimers)
ktime accessors
Kernel Timing and Timers Source Code Pointers
Timing and benchmarking
7 Wed, Sep 22nd Kernel tracing and debugging

Overview of the Lab 1 Assignment
Guest Lecturer: Marion Sudvarg
LKD pp. 363-371 (chapter 18 Debugging through Asserting Bugs and Dumping Information)
Ftrace overview document
Kernelshark
Ftrace Source Code Pointers
Tracing with ftrace and Kernelshark

Lab 1 Assigned (due Fri, Oct 15th Sun, Oct 17th at 11:59PM)
8 Mon, Sep 27th Processes LKD chapter 3
LPI chapters 20.1, 24.1-24.2 (re-read), 24.4, 25, 26.1.1-26.1.4, and 26.2
Linux Process Source Code Pointers
Process Family Tree
9 Wed, Sep 29th Kernel synchronization I LKD chapter 9 In-class lab (or studio catch up) time
10 Mon, Oct 4th Kernel synchronization II LKD chapter 10
What is RCU, fundamentally?
Kernel Reference on RCU
Kernel Races, Atomicity, and Synchronization
11 Wed, Oct 6th Userspace synchronization LPI chapters 30 and 31
Read these man pages (opened when you run these commands) on a Linux machine:
man 7 futex
man 2 futex
Build Your Own Locks
Mon, Oct 11th: Fall Break - no classes
12 Wed, Oct 13th Exam 1 Review All studios assigned so far are due by Wed, Oct 13th at 11:59PM

Lab 1 due by Fri, Oct 15th Sun, Oct 17th at 11:59PM
13 Mon, Oct 18th Exam 1
14 Wed, Oct 20th Virtual memory and paging

Kernel memory

Overview of the Lab 2 Assignment
LKD chapter 12 Kernel memory management

Lab 2 Assigned (due Fri, Nov 12th Sun, Nov 14th at 11:59PM)

15 Mon, Oct 25th Address spaces / shared memory LKD chapter 15
Read these man pages (opened when you run these commands) on a Linux machine:
man 2 mmap
man 3 shm_open
Shared memory management
16 Wed, Oct 27th Virtual filesystem LKD chapter 13 VFS layer
17 Mon, Nov 1st Buffer and File I/O LPI Chapters 4, 5, and 13
Read these man pages (opened when you run these commands) on a Linux machine:
man 2 read
man 2 write
man 2 readv
man 2 writev
man 3 stdio
Buffer and File I/O
18 Wed, Nov 3rd Inter-process communication: pipes and FIFOs LPI chapters 44.1-44.3, 44.6-44.11
The LPG pages on Pipes and FIFOs
Read these man pages (opened when you run these commands) on a Linux machine:
man 2 pipe
man 3 mkfifo
man 3 getline
Linux pipes and FIFOs
19 Mon, Nov 8th Inter-process communication: sockets LPI chapters 12.2, 56.1-56.6, 57.1-57.2, 57.4, 58.5, 58.6.1, 59.1-59.6, 59.10, 59.11
Read these man pages (opened when you run these commands) on a Linux machine:
man 2 bind
man 7 unix
man 7 ip
man 3 htons
man 3 getaddrinfo
man 2 gethostname
man 3 getnameinfo
Sockets
20 Wed, Nov 10th I/O multiplexing mechanisms and performance considerations

Overview of the Lab 3 Assignment
LPI chapter 63
LKD chapter 14
I/O event handling

Lab 3 Assigned (due Fri, Dec 10th at 11:59PM)

Lab 2 due Fri, Nov 12th Sun, Nov 14th at 11:59PM
21 Mon, Nov 15th Signals LPI chapters 20, 21.1, 21.4-21.6, 22.1-22.8, 24.5, 26.3
Read these man pages (opened when you run these commands) on a Linux machine:
man 7 signal
man 7 signal-safety
man 2 sigaction
man 2 write
man 2 getrlimit
Linux Signals
22 Wed, Nov 17th Traditional Process Scheduling LKD chapter 4 (except for pp. 64-65 Real-Time Scheduling Policies)
LPI chapter 35.1 and 35.4
Completely Fair Scheduling
23 Mon, Nov 22nd Real-time process scheduling LKD pp. 64-65 (chapter 4 Real-Time Scheduling Policies)
LPI chapter 35.2, 35.3, and 35.5
Deadline Scheduling vs POSIX Real-time Scheduling
Thread prioritization in kernel modules
The on-line man 7 sched page.
Real-time Scheduling
Wed, Nov 24th: Thanksgiving Day Holiday - no classes
24 Mon, Nov 29th Interrupts and interrupt handlers LKD chapter 7
Linux source: current irq flags
Why IRQF_DISABLED is no longer used
In-class lab (or studio catch up) time
25 Mon, Dec 1st Bottom half processing LKD chapter 8
Linux source: current softirqs
Threaded interrupt handlers
Software Interrupts and Real-time
In-class lab (or studio catch up) time
26 Mon, Dec 6th Exam 2 Review All studios assigned since Exam 1 are due by Wed, Dec 6th at 11:59PM
27 Wed, Dec 8th Exam 2 Lab 3 due Fri, Dec 10th at 11:59PM

Lab Projects

There will be three lab assignments for this course. The purpose of these labs is to apply course concepts and to evaluate kernel mechanisms and behaviors. As such, each lab will require a written report detailing your findings in addition to the code you wrote.

Each lab will be completed in a team of up to three students, and teams may be different for each lab or may remain the same. Students from different teams may discuss the lab assignments only during regularly scheduled sessions (class meeting times and regular weekly TA office hours) that the instructors or TAs are attending, when anyone is able to join in those discussions. Students on the same team are of course encouraged to discuss and work on lab assignments at any time.

Labs submitted on time (as determined by timestamps in Canvas) will be graded for full credit. Labs submitted up to 24 hours late may be given a ten percent penalty. Labs submitted between 24 and 48 hours late may be given a twenty percent penalty. Labs submitted after 48 hours late may not be given credit, except in the case of extenuating circumstances approved by the instructor. If you anticipate that your team may need an extension on a lab assignment, please make sure to ask prior to the deadline.


FAQ/Tips

Current and past instructors, TAs, and students of the CSE 422/522 courses have contributed various tips, tricks, and solutions to problems that they have encountered. Please let your instructor know if you have something you'd like to add here!

Class FAQ

   What if your Pi is freezing up?

   Accessing your Raspberry Pi Remotely


Computers, Textbooks, and Other Resources

To be able to complete the studios and lab assignments this semester, you will need to purchase a CanaKit Raspberry Pi 3 B+ Starter Kit (32 GB EVO+ Edition), which is the platform on which we have tested out our solutions to those assignments, and on which we will be grading them.

The in-class studios and assigned readings offer a reasonable coverage of Linux. However, the studios and assigned readings will not yet make you an expert on the Linux kernel. When it comes to learning the details of a code base as deep and complex as Linux, there is no substitute for reading source code. Some of the lectures and studios will give pointers to relevant source code files, and for overall understanding it is expected that students will spend some time absorbing the content there as well.

To be clear, you are not expected to understand or memorize every line of the Linux source. The exams will not have questions derived directly from the Linux source (though basic kernel concepts and pseudo-code are fair game). However, the kernel is a huge set of deeply interdependent source code files. A useful way to understand it more and more thoroughly is by looking through it many times.

There are two required textbooks for this course:

Linux Kernel Development by Robert Love, 2010 (noted as LKD in the assigned readings). This is an excellent, compact, and inexpensive text that gives the reader a basic but also reasonably detailed understanding of kernel design, written in depth by a Linux kernel expert.

The Linux Programming Interface by Michael Kerrisk, 2010 (noted as LPI in the assigned readings). This an excellent, somewhat more extensive reference manual, also written in depth by a Linux kernel expert.

Please note that the Linux kernel source code is frequently (and sometimes rapidly) updated, so that while the general information in these textbooks is correct, many details of the source code itself, the names of source code files, and where those files exist, are somewhat likely to change (and have done so since the required text books above and the additional references below were written).

There are a number of other references that you may find useful for this course and more broadly for your study and use of the Linux kernel.

Students will need to acquire a Raspberry Pi 3 B+ in order to complete daily studios and lab assignments. To increase flexibility during the Covid-19 pandemic, so that students can work from remote locations as well as on campus, the studio and lab instructions in this course have been redesigned to support a variety of different settings in which the Raspberry Pi 3 B+. If you run into any problems using your Raspberry Pi 3 B+ in this course this semester please let us know right away so we can help.


Grading

There are three activities for which you will receive credit in this course: studios, exams, and labs. Studios are daily guided assignments primarily designed to familiarize you with course concepts, development tools, and the kernel source code (i.e. knowledge and comprehension tasks). Exams will evaluate your technical understanding of course concepts, including nuances of the material covered in the lectures and in the assigned readings. The lab assignments will ask you to apply course concepts and analyze and implement design alternatives.

We will make every effort to grade each of your studios, and to post a grade in Canvas and provide comments to you regarding it, within one week (7 days) of when it is submitted. We will strive to post exam grades and return graded exams within 10 days, and for lab assignments will work to do so within 14 days.

Especially for the early studios, even though they are not due until just before the first exam, please do work to submit them as early as you can so that you'll have grades and feedback on at least a few of them prior to the end of the semester's drop/add period.

Your semester grade will be determined as follows, with an overall weighted average of 90% corresponding to at least an A-, of 80% corresponding to at least a B-, and of 70% to at least a C-  and to a passing grade if the course is being taken P/F rather than for a letter grade:

Activity Grade Percentage
Studios 15%
Exam 1 20%
Exam 2 20%
Lab 1 10%
Lab 2 15%
Lab 3 20%

Academic Support, Health and Wellness, and Disabilities

Especially with the challenges many students may face in an on-line learning environment, we encourage everyone to take a look at, and potentially make use of, the many academic support resources available at Washington University in St. Louis, including: The Learning Center, and The Writing Center, and Student Technology Services.

Washington University recognizes that students serving in the U.S. Armed Forces and their family members may encounter situations where military service forces them to withdraw from a course of study, sometimes with little notice. Students may contact the Office of Military and Veteran Services at (314) 935-2609 or veterans@wustl.edu and their academic dean for guidance and assistance.

The Habif Health and Wellness Center, WashU Cares, Mental Health Services, and RSVP are important university resources for issues pertaining to physical and mental health.

Students with disabilities or suspected disabilities are strongly encouraged both to bring any additional considerations to the attention of the instructor and to make full use of Washington University's Disability Resources, potentially including accommodations for studios, labs, and/or exams.


Title IX, Diversity, and Inclusion

Washington University is firmly committed to addressing and preventing sexual misconduct on our campuses: please see the Washington University statement on new Title IX rules. If a student discusses or discloses an instance of sexual assault, sex discrimination, sexual harassment, dating violence, domestic violence or stalking, or if a faculty member otherwise observes or becomes aware of such an allegation, the faculty member will keep the information as private as possible, but as a faculty member of Washington University, they are required to report it immediately to their Department Chair or Dean or directly to Ms. Jessica Kennedy, the University's Title IX Director, at (314) 935-3118 or jwkennedy@wustl.edu. Additionally, incidents or complaints can be reported to the Office of Student Conduct and Community Standards or by contacting WUPD at (314) 935-5555 or contacting your local law enforcement agency. To explore options for medical care, protections, or reporting, free and confidential support resources and professional counseling services are available through the Relationship and Sexual Violence Prevention (RSVP) Center in Seigle Hall, Suite 435, which can be reached at rsvpcenter@wustl.edu or at (314) 935-3445. For after-hours emergency response services, call 314-935-6666 or 314-935-5555 and ask to speak with an RSVP Counselor on call.

Washington University's Center for Diversity and Inclusion supports and advocates for undergraduate, graduate, and professional school students from underrepresented and/or marginalized populations, collaborates with campus and community partners, and promotes dialogue and social change to cultivate and foster a supportive campus climate for students of all backgrounds, cultures, and identities. The University has a process through which students, faculty, staff, and community members who have experienced or witnessed incidents of bias, prejudice, or discrimination against a student can report their experiences to the University's Bias Report and Support System team. For procedures and information on reporting an instance of bias, please visit the Bias Report and Support System page on the Center for Diversity and Inclusion web site. In order to affirm each person's gender identity and lived experiences, it is important that we each ask and check in with others about pronouns. This simple effort can make a profound difference in a person's experience of safety, respect, and support. Please see the University's Pronouns Information page and the Office of the Registrar's Preferred Name page for additional information and resources.


Academic Integrity

Each studio and lab assigned in this course is expected to be completed collaboratively in teams of up to three people (and not more than that), though you are permitted to work individually on any assignment instead, if you prefer. During the scheduled class time and office hours that the instructors are attending, students may be allowed to discuss problems and/or share their screens to show code for purposes of getting help with debugging, illustrating solution approaches that are being discussed, etc., and communication about a particular studio or lab assignment within your team of (3 or fewer) people who are working together on it is allowed at any time. Communication between different teams is not allowed outside of the scheduled sessions that instructors and/or TAs are attending. Student teams may change from assignment to assignment, but the sharing of code between teams without prior permission of the instructor is strictly prohibited, and you must acknowledge and document in detail all contributions that anyone has made to the work.

To encourage you to read the Linux man pages and LPI and LKD text books carefully, you are allowed to use snippets of code from those sources in your studios and labs exams without asking permission, as long as (in comments before and after it) you clearly identify the start and end of each such code snippet and attribute the source from which it came (including page and/or line numbers where those are available). For code from any other sources you must first ask for and receive permission from your professor (and should identify and attribute it similarly if so).

Exams must be completed individually without assistance from any other person, and without reference to external materials except as is specifically allowed by the instructor (documentation of what is allowed will be described in the review lecture, provided in the corresponding review slides, and written on the font page of the exam).

Cheating costs everyone something. Someone who cheats misses out on the intended opportunity to improve through the assigned work, and like anyone helping them cheat is at risk of diminished reputation as well as specific sanctions (see below). Cheating also degrades the value of the degree earned by those who complete their work with integrity.

Academic integrity is a serious matter in this course, and the instructor will decide whether any situation of concern in this course warrants referral to the appropriate formal academic integrity adjudication process at the school or university level. If in any doubt, please ask your instructor first.

Anyone found to have cheated or to have helped someone else cheat will face penalties that may include receiving a negative score equal in magnitude to the value of the assignment in question (e.g., cheating on an assignment worth 10% of the course grade would result in -10% being assigned for a total loss of 20% from the course grade, which is twice as large a loss as simply not turning in the assignment).

Academic integrity is itself worth studying and thinking about as a key component of your education. Please read, familiarize yourself with, and reflect on the Engineering School's and Washington University's undergraduate and graduate policies on academic integrity.