CS107E Computer Systems from the Ground Up
Curious about the course? Below we answer some of the questions commonly asked by prospective students.
What is CS107E?
Both CS107 and CS107E introduce students to the fundamental concepts of computer systems, exploring how these five concepts come together: hardware, architecture, assembly code, the C language, and software development tools. Our classic CS107 course is taught on a hosted Linux system using a full complement of libraries and tools. The CS107E course is a novel alternative that explores the same concepts through bare-metal programming on the Raspberry Pi. CS107E students do all programming with a Raspberry Pi kit and hardware add-ons such as LEDs, buttons, and sensors.
What are the course topics for CS107/CS107E?
Both CS107 and CS107E cover the C programming language, data representation, machine-level code, computer arithmetic, compilation, memory organization and management, program execution, debugging, and performance. Additionally, CS107E includes topics in hardware and I/O.
What are the differences between CS107 and CS107E? What factors should I consider to determine which course is right for me?
We think both courses are great and either will serve as an excellent introduction to computer systems. They cover the same core concepts and both require significant programming in C/asm. The major difference is the system being explored. CS107 students work on linux running on the x86 architecture. This modern, hosted system provides the advantages of sophisticated libraries and tools, but it puts you at arms' length away from the hardware (no direct access to processor, I/O, or framebuffer). CS107E runs bare-metal (no OS or libraries) on a Raspberry PI ARM architecture. There is nothing standing between you and the hardware, but the environment is somewhat more primitive and edit/compile/debug must be done via cross-system tools.
Here are a few other issues you may want to consider in comparing the two options:
- Assignments: The CS107E assignments incrementally build up an implementation of simple console, allowing students to experience constructing a working computer system from scratch. The CS107 assignments explore various aspects of systems programming with a more software-centric focus.
- Final project: CS107E ends with a significant final project where students work in teams on an ambitious project of their own design that implements a complete hardware/software system. There is no project component to CS107.
- Exams: There are no exams in CS107E. CS107 has a midterm and final exam.
- Difficulty: The intention is to maintain comparable difficulty and workload for CS107 and CS107E. In either course, the set of programming assignments is demanding, and we are committed to these invaluable exercises that will strengthen your programming skills.
- Tools: Both courses use similar gcc toolchain (CS107E is cross-compile), but CS107 students have access to richer suite of tools (gdb/valgrind/callgrind) and the linux/x86 mileage may have a more direct payoff in subsequent projects due to the ubiquity of such systems.
- CS vs EE: Because CS107E touches on both hardware and software, it serves a mix of EE and CS students. CS107E might be a better fit for EE students who are interested in low-level software and embedded systems, while CS107 is a better fit for EE students who are interested in more traditional software engineering. Either CS107 or CS107E applies to the systems core requirements for the CS undergrad major.
- History: CS107 has existed in its current form for about eight years, whereas CS107E is a relatively new offering. CS107's longer history has given the course time to mature and you can expect more widespread "institutional knowledge", e.g. upperclass students in your dorm who could advise you when stuck :-). CS107E being the young upstart welcomes a spirit of adventure, but there may be the occasional surprise or lack of polish. Your flexibility and self-sufficiency will be assets in working through any unexpected obstacles.
- Materials: Take a look at recent course materials to get additional information: CS107 is at cs107.stanford.edu and CS107E is at cs107e.github.io. Reviewing the syllabus, labs, and assignments will give you a better feel and allow you to consider the fit of each course in relation to your experience and own learning goals.
Whether you take CS107 or CS107E, you'll learn how a computer system operates and work hard to gain mastery over these topics and advance from a novice programmer to an effective practitioner. Students who do well in either course are excellently positioned to apply these powerful skills to future CS, EE, or ME projects!
Axess says that CS107E has limited capacity and enrollment requires instructor consent. What does this mean?
Students who are interested in CS107E must attend the first class meeting. We will distribute a questionnaire for you to complete where you can share your prior experience and interest in the course. If we have more interested students than our enrollment cap, we will use the questionnaire responses to select students. Priority will be given to freshmen and sophomores.
What equipment will I need to participate in CS107E?
Each CS107E student will be given a kit containing a Raspberry Pi, breadboard, jumpers, LEDs, transistors, and other parts. There is $50 lab fee for the parts kit. We can arrange a scholarship for any student for whom the fee is hardship-- please contact the instructors. You will also need a laptop (Mac OS, Linux, or Windows) on which you can install the needed cross-development tools. The laptop will need a USB 3.0 port (USB-C with adapter also ok). Access to an HDMI display is a nice-to-have, but there are shared monitors available for student use in our lab room.
When is CS107E offered?
CS107E is scheduled for winter and spring quarters of the 2017-18 academic year. The weekly schedule consists of two lectures and one lab session. In winter quarter, lectures are scheduled for Monday and Friday 11:30am-12:50pm and lab sessions meet 6:30pm-8:30pm either Tuesday or Wednesday evening. Lecture attendance is expected and participation in lab is mandatory.
Will the CS107E lectures/labs be recorded? Is attendance required?
CS107E is not being offered via SCPD and lectures will not be recorded. Lecture attendance is expected and participation in lab is mandatory. (An ode to "did I miss anything"?) If your schedule doesn't permit you to consistently attend lecture/lab, we recommend choosing a different course than this one.
What are the course prerequisites for CS107/CS107E?
Successful completion of CS106B/X (or equivalent) and eagerness to advance to the next level. You should be an accomplished programmer who has practical C/C++ skills using recursion, dynamic data structures (pointers, linked lists, trees), data abstraction, classic data structures (lists, stacks, queues, sets, maps), and standard algorithms (searching, sorting, hashing). You should have an appreciation of the intrinsic value of good engineering and design and you will be expected to produce well-decomposed, readable code. If you feel on the fence in determining your placement between CS106B/X and CS107/107E, our strong recommendation is to pursue CS106B/X -- we love this course! It is lots of fun, supremely well-taught, and produces thoughtful and accomplished apprentice programmers. You will exit CS106B/X well-prepared to go on to a satisfying and successful experience in CS107/CS107E.
Still have questions?
If your question is not answered here, email us at and we can help you out!
Welcome to the Winter 2018 offering of CS107e!
CS107 is the third course in Stanford’s introductory programming sequence. CS106 provides students with a solid foundation in programming methodology and abstractions, and CS107 follows on to give you the skills needed to build computer systems.
There are two major learning goals for the course.
First, to understand how computers represent information, execute programs, and control peripherals.
Second, to master command-line programming tools and the C programming language.
The course builds understanding from the ground up using bare metal programming on the Raspberry Pi. Bare metal programming uses no operating system and few external libraries.
Students will receive a Raspberry Pi and a kit of parts, and all assignments will run on the Raspberry Pi. Assignments build upon each other by adding more and more functionality to a core library. They culminate in a simple personal computer shell using a keyboard and display.
Finally, students do a project of their choosing where they build a complete hardware-software system.
For information about the differences between CS107 and CS107e, check out this FAQ.
All class announcements will be posted on Piazza.
- Lectures: Mon & Fri 11:30 AM-12:50 PM, Room 124, Building 160
- Labs: Tue & Wed 6:30 PM-8:30 PM, Gates B21
- Lecturers: Julie Zelenski, Pat Hanrahan
- CAs: Lenny Truong, Mark Miller, Anna Zeng, Michelle Park
In the readings, K&R is The C Programming Language (Kernighan and Ritchie), and EssentialC is a PDF available via Stanford’s CS Library. A digital copy of K&R is available to Stanford students via Safari Books Online.
Please read the assigned readings before attending lecture and lab. You should also read the guides for each week.
Winter 2018 schedule.
|Week 1 Jan 8|
|Lecture 1 (Mon): Introduction (slides)||Review electricity, binary and hexadecimal numbers and bitwise operations, and the unix command line.|
|No Lab (Review this library of unix reference documents and videos from CS107)|
|Assignment 0: Choose Lab Section, Learn Git|
|Lecture 2 (Fri): Introduction to ARM processor and memory architecture (slides, code)||Start with Baking Pi ( intro, ok01, ok02 ) and then read about ARM ASM. I also recommend you read Steven Wolfram's blog post Untangling the Tale of Ada Lovelace for a nice descption of Charles Babbage's and Lady Ada Lovelace's roles in developing the concept of a general-purpose computer.|
|Week 2 Jan 15|
|Lecture 3: ARM Assembly Language and Machine Code (screencast, slides, code)||Read/Skim sections 4.1-4.5 from the ARM Instruction Set Architecture manual. Read Danny Cohen's article Holy Wars and a Plea for Peace on the history of littie-endian vs. big-endian.|
|Lab 1: Setup the Raspberry Pi|
|Assignment 1: Implement a Larson Scanner|
|Lecture 4 (Fri): From ASM to C (slides, code)||Brush up on C syntax, data types, operators, control structure, and function calls. EssentialC chapters 1 and 2; or K&R 1, 2, and 3. Skip sections involving characters, strings, io, and standard libraries. Read about the history of C|
|Week 3 Jan 22|
|Lecture 5 (Mon): C: Pointers and Arrays (slides, code)||EssentialC chapters 3 (skip material on structures) and 6 (skip material on the heap and memory management).; or K&R and 5.1-5.4. Make sure to read the sections involving characters and strings.|
|Lab 2: Below C Level|
|Assignment 2: Implement a Clock|
|Lecture 6 (Fri): Functions (slides, code)||Read (or read again) about functions in C (Chapter 4 in K&R, Section 4 in Essential C), Read this nice explanation of local data and frame pointers|
|Week 4 Jan 29|
|Lecture 7 (Mon): Communication and the Serial Protocol (slides, code)||Read about characters and strings, basic IO (getc, putc, puts, printf), and structures (Section 1.5, 1.6, 1.9, 5.5, 6, 7 in K&R; Section 3 in EssentialC). Read about Serial Communication.|
|Lab 3: Debugging and Testing|
|Assignment 3: Implement a String Formatting Library|
|Lecture 8 (Fri): Modules and Libraries: Linking (slides, code),||Read David Welch's articles on baremetal programming and bss data.|
|Week 5 Feb 5|
|Lecture 9 (Mon): Memory Management (slides, code)|
|Lab 4: Linked and Loaded|
|Assignment 4: Backtrace and Malloc|
|Lecture 10 (Fri): C mastery (slides, code)|
|Week 6 Feb 12|
|Lecture 11 (Mon): Keyboards and the PS/2 Protocol (slides, code)||Read about the PS/2 protocol for keyboards and mice|
|Lab 5: Keyboard Surfin|
|Assignment 5: Keyboard and Simple Shell|
|Lecture 12 (Fri): Graphics and the framebuffer (slides, code)||Read more about the Framebuffer in the Baking Pi lectures (Screen01, Screen02, Screen03, Screen04).|
|Week 7 Feb 19|
|President's Day (no class)|
|Lab 6: Drawing into the Framebuffer|
|Assignment 6: Graphics Library and Console|
|Lecture 13 (Fri): Interrupts ( slides, code, minimal timer interrupt example code )|
|Week 8 Feb 26|
|Lecture 14 (Mon): Interrupts and Concurrency (slides, code)|
|Lab 7: Raspberry Pi, Interrupted|
|Assignment 7: System Monitor with Interrupts||Read Project Suggestions and Guides for inspiration|
|Lecture 15 (Fri): Sensors (slides, code), and Sound (slides, code)|
|Week 9 Mar 5|
|Lecture 16 (Mon): Performance (Anna, slides, code), Git Workflow (Lenny, slides)||Read Atlassian's guide to the Git Feature Branch Workflow|
|Project Lab 1||Project Lab 1: What is Your Project?|
|Lecture 17 (Fri): Computer Arithmetic (slides, code)|
|Week 10 Mar 12|
|Lecture 18 (Mon): Wrap (slides)|
|Project Lab 2||Project Lab 2: How Are You Doing?|
|Week 11 Mar 19|
|Fri Mar 23 9:00-11:30 am: Final project demonstrations|