engineering.wustl.edu

E81 CSE 422S: Operating Systems Organization

Spring 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 Chris Gill (Virtual office hours after the lecture on Tuesdays and Thursdays 11:30am-12:45pm US Central Time and by appointment)
Teaching Assistants Tommy Keating (Virtual office hours Mondays and Wednesdays 11am-noon US Central Time)
Jackie Zhong (Virtual office hours Thursdays 2:30-3:30pm and Fridays 11am-1pm)
Course Web Site http://www.cse.wustl.edu/~cdgill/courses/cse422_sp21/
Piazza Page https://piazza.com/wustl/spring2021/cse422s/home

Course Meetings Due to the Covid-19 pandemic, CSE 422S Operating Systems Organization again will be conducted entirely on-line this semester, using significant additional infrastructure based on tools like Canvas, Zoom, and Piazza to support effective on-line interactions and active learning even from remote locations. The regularly scheduled class meetings will be held on Tuesdays and Thursdays 11:30am - 12:45pm, by university policy ending 5 minutes earlier this semester than is listed in the bulletin to facilitate students' transitions between classes.

The regularly scheduled class meetings (Tuesdays and Thursdays 11:30am - 12:45pm) will begin with a lecture, and the remaining time will be used as virtual office hours, with opportunities throughout for students enrolled in the course to ask questions via zoom. Your instructor will remain available on zoom throughout the scheduled class times to answer questions about the studios and labs, to help debug issues students have run into while doing those, and otherwise to facilitate group work on the studios and/or labs. Class meetings will be recorded and once each recording is available it will be linked on specific pages of the course modules in Canvas.

Students will be expected to keep up on the readings and lectures, to use Piazza and other course resources, and to attend sufficient virtual office hours on Zoom 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, though attending at least a couple of virtual office hour sessions per week (ideally the scheduled class times) is strongly encouraged as a baseline.

Students who will be on campus this semester, or who require accommodations due to the Covid-19 pandemic, should please read and follow Washington University's COVID-19 Health and Safety Protocols and other related policies.

Take Home Exam 1
Released in Canvas 4pm Thu Feb 18th, Due in Canvas 4pm Fri, Feb 19th (24 hours later)
Take Home Exam 2
Released in Canvas 4pm Thu Mar 25th, Due in Canvas 4pm Fri, Mar 26th (24 hours later)
Take Home Exam 3
Released in Canvas 4pm Thu, Apr 29th, Due in Canvas 4pm Fri, Apr 30th (24 hours later)
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 Tue, Jan 26th Academic Integrity
Introduction to Linux
LKD chapters 1,2
A Brief Overview of the Linux Source Tree
Building the Linux kernel
2 Thu, Jan 28th Setting up the Raspberry Pi 3 LPI chapters 1-3 Setting up the Raspberry Pi 3 B+
3 Tue, Feb 2nd Program execution, linking, layout LPI pp. 515-522 and 563-571
LKD pp. 29-33 and 38-40
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 Thu, Feb 4th How and when does the kernel run? LKD chapter 5
Userspace / Kernelspace API Split
System Call Source Code Pointers
Creating a syscall
5 Tue, Feb 9th Structure and infrastructure of the Linux kernel LKD chapter 6 and pp. 337-348
A simplified IDR API
Writing a kernel module
6 Thu, Feb 11th Time sources and timing 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 Tue, Feb 16th Kernel tracing and debugging

Overview of the Lab 1 Assignment
LKD chapter 18: pp. 363-371
Ftrace overview document
Kernelshark
Ftrace Source Code Pointers
Tracing with ftrace and Kernelshark

Lab 1 Assigned (due Fri, Mar 12th at 11:59PM)

All studios assigned so far are due by Wed, Feb 17th at 11:59PM
8 Thu, Feb 18th Exam 1 Review
Take Home Exam 1 released in Canvas 4pm Thu, Feb 18th, due in Canvas by 4pm Fri, Feb 19th (24 hours later)
9 Tue, Feb 23rd Processes LKD chapter 3
LPI chapters 24.1-24.2, 24.4-24.6, 25, 26.1.1-26.1.4, and 26.2-26.4
Linux Process Source Code Pointers
Process Family Tree
10 Thu, Feb 25th Kernel synchronization I LKD chapter 9 In-class lab (or studio catch up) time
Tue, Mar 2nd: Wellness Day - no classes
11 Thu, Mar 4th Kernel synchronization II LKD chapter 10
What is RCU, fundamentally?
Kernel Reference on RCU
Kernel Races, Atomicity, and Synchronization
12 Tue, Mar 9th 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
13 Thu, Mar 11th Virtual memory and paging

Kernel memory

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

Lab 2 Assigned (due Fri, Apr 9th at 11:59PM)

Lab 1 due Fri, Mar 12th at 11:59PM
14 Tue, Mar 16th 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
15 Thu, Mar 18th Virtual filesystem LKD chapter 13 VFS layer
16 Tue, Mar 23rd Buffer and File I/O 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
Buffer and File I/O

All studios assigned since Exam 1 are due by Wed, Mar 24th at 11:59PM
17 Thu, Mar 25th Exam 2 Review
Take Home Exam 2 released in Canvas 4pm Thu, Mar 25th, due in Canvas by 4pm Fri, Mar 26th (24 hours later)
18 Tue, Mar 30th 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
Linux pipes and FIFOs
19 Thu, Apr 1st Inter-process communication: sockets 56.1-56.6, 57.1, 57.2, 57.4, 58.5, 58.6.1, 59.4-59.6, 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
Sockets
20 Tue, Apr 6th 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 Tue, May 4th at 11:59PM)
21 Thu, Apr 8th Signals LPI chapters 20, 21.1, 21.4-21.6, 22.1-22.8
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

Lab 2 due Fri, Apr 9th at 11:59PM
22 Tue, Apr 13th Traditional Process Scheduling LKD chapter 4
LPI chapter 35: sections 35.1 and 35.4
Completely Fair Scheduling
23 Thu, Apr 15th Real-time process scheduling LKD chapter 4: pp. 64-65
LPI chapter 35: sections 35.2, 35.3, and 35.5
Deadline Scheduling vs POSIX Real-time Scheduling
The on-line man 7 sched page.
Real-time Scheduling
24 Tue, Apr 20th Interrupts and interrupt handlers LKD chapter 7
Linux source: current softirqs
Linux source: current irq flags
Why IRQF_DISABLED is no longer used
Threaded interrupt handlers
Thread prioritization in kernel modules
In-class lab (or studio catch up) time
25 Thu, Apr 22nd Bottom half processing LKD chapter 8
Software Interrupts and Real-time
In-class lab (or studio catch up) time
26 Tue, Apr 27th No lecture or assigned readings: in-class lab (or studio catch up) time
All studios assigned since Exam 2 are due by Wed, Apr 28th at 11:59PM
27 Thu, Apr 29th Exam 3 Review
Take Home Exam 3 released in Canvas 4pm Thu, Apr 29th, due in Canvas by 4pm Fri, Apr 30th (24 hours later)
28 Tue, May 4th No lecture or assigned readings: in-class lab time

Lab 3 due Tue, May 4th 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 the regularly scheduled zoom 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 your work, and to post a grade in Canvas and provide comments to you regarding it, within one week (7 days) of when it is submitted.

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 25%
Exam 1 10%
Exam 2 10%
Exam 3 10%
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 Gender 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 zoom sessions that the instructors are attending, students may be allowed to 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 zoom sessions that the instructors 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, labs, and 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.