CS 201: Computer Systems Programming

Winter 2019

This is a tentative syllabus. Everything here is subject to change with little notice.

Course Info

Who: Bart Massey bart@cs.pdx.edu
TA: Arash Mirhosseini sey@pdx.edu
Times: 1400-1550 (2:00-3:50PM) Mondays and Wednesdays
Dates: 7 January -- 13 March (Final Exam 20 March)
Where: Cramer Hall (CH) 269
Office Hours: By e-mail appointment
TA Office Hours: 10:00AM-12:30 Wednesdays (Fishbowl)
CRN: 40827 (sec 7)

Course Schedule

Week 1: Computing Basics

Week 2: C Systems Programming

Week 3: C Specifics

  • Read: Textbook 3.1-3.3; (K&R)
  • Homework 1 due Wed 23 January noon
  • Homework 2 assigned.
  • Mon 21 January: Martin Luther King, Jr. Day, University Closed
  • Wed 23 January: C Datatypes

Week 4: C To Machine Code

Week 5: x86-64 Assembly and Machine Code

Week 6: x86-64 In More Depth

Week 7: Machine-Level Modularity

Week 8: C as a Systems Language

Week 9: Memory

Week 10: Final Topics

Final Exam

  • Wednesday 20 March 1230-1420 (12:30-2:20PM)

Reference Material

About This Course

This course teaches thinking about computers as hardware on which software runs, and thinking about software as something that runs on hardware. This is necessary for a computer scientist who wants to connect their work with the real world. It is even more necessary for industry folks. Getting an efficient, correct and secure systems often depends on understanding low-level details and inner workings of computers and programs.

Course Description

The catalog says "Introduction to computer systems from a software perspective." It then gives a long list of these kinds of topics.

In this course, we will learn how computer programs are run by a computer. We get a low-level view of instructions and data. We will learn about how the software of modern computer systems interacts with the fancy hardware underneath.

Course Goals

The catalog says:

Introduce computer systems from a software perspective. Teach C and assembly language programming and reading skills. Teach basic systems programming skills and tools. Show how to measure and improve program performance based on an understanding of key aspects of machine architecture.

The catalog's list of course goals is that students be able to:

  • Describe basic computer system organization including the operating system (processes, files, virtual memory) and the underlying hardware (CPU, registers, memory hierarchy).

  • Describe the compilation system (preprocessing, assembling, compiling, and linking) and the function of object/executable files and shared libraries, as well as how basic system utilities such as debuggers and Makefiles work.

  • Write C programs to illustrate basic systems programming concepts, including file I/O, system calls, memory management, exception handling and process management.

  • Do arithmetic in hexadecimal, decimal, octal, and binary notation, and convert among these notations.

  • Explain how data types such as integers, characters, floating point numbers, arrays, pointers, and structures are represented.

  • Describe the basic instruction set architecture for the IA32 family (or similar machine), including the arithmetic/logic instructions, registers, memory model and addressing, and control instructions.

  • Explain how high-level programming constructs such as loops and stack-based function calls are implemented in underlying machine code.

  • Explain how exceptions, traps, and context switches occur and how they are handled at the machine level.

  • Explain the performance impact of hardware features such as pipelining, and architecture principles such as memory locality.

  • Use profiling and timing facilities to identify performance bottlenecks in C programs.

Seems like enough for 10 weeks.

A Sister Course

Prof. Mark Morrissey is teaching this course this quarter as well. We will be somewhat parallel but not the same. Still, Mark's syllabus is full of useful information. In particular, his and Prof. Wu-Chi Feng's lecture notes and video lectures, linked from there, are quite a bit different and more mature and beautiful than mine. Plus, he has links to a lot of great resources. I'd recommend checking his stuff out.

Course Mechanics

This course is a high-effort vital part of the PSU undergraduate CS curriculum. There will be lectures, quizzes, examinations and homework.


There's a Slack workspace at <psu-cs201-w2019.slack.com> for messaging. You need to be on it. Instructions will be emailed to you during the first week of class.

You should contact me anytime for an appointment if there are things that seem worth discussing. Special and/or regular office hours will be run by the TA (and sometimes by me).


The course lectures have a lot of stuff in them. Please attend them all; they are required and will be useful. You need to be in class every session. If you cannot make it to class, please contact the TA in advance of the class meeting. The TA will advise you on how to deal with the situation.


The course textbook is

Computer Systems: A Programmer's Perspective (3rd ed.)
Bryant and O'Hallaron, Pearson 2016

You will need the third edition, as it switches from x86 to x86-64 for the target architecture. The book is expensive in hardcover, but paperback is available at a quite reasonable price through Amazon.

The textbook is quite complete and clear for the topics it covers.

An optional but really useful book for the C programming language is

The C Programming Language (2nd ed.)
Kernighan and Ritchie, Prentice Hall 1988

You can find this book used at Powell's or online.

An extremely optional but awesome book on bit manipulation is

Hacker's Delight (2nd ed)
Henry S Warren, Jr., Addison-Wesley 2012


There will be a quiz and a homework assignment each week.

There will be a final examination, which will consist of adapted versions of quiz questions.


A brief quiz will be given at the start of class every Monday. It will cover last week's material and this week's assigned reading.

You need to be in class for the quiz. If you cannot make it for some reason, you might be able to arrange with the TA to take it the week before during the TA office hours. Please don't do this, though: just come to class.


Homework will be assigned each week. Homeworks will consist of question-and-answer, small projects, and some computer-aided stuff.

The CS tutors are a resource you can make use of. They are very good at helping you to understand compilation errors and use debuggers. Please ask on the Slack #help channel for help with homework-specific questions.

Due to the size of the course and the volume of material to be covered, we won't take late assignments. A grade of 0 may be given to any assignment not turned in on time. A zero on any one assignment is grounds for failure in the course.


  • Homework: 40%
  • Quizzes: 30%
  • Final: 30%

Hardware and Software

This class is x86-64 UNIX-based. You will need access to a genuine actual x86-64 computer running Linux, BSD or some other form of UNIX for in-class and out-of-class work. It is highly recommended that you bring an appropriate laptop to class. If you cannot afford a laptop, you may:

  • Borrow one from the Department for the quarter. Contact the Department Chair.

  • Go to FreeGeek in Southeast Portland, which has cheap laptops and may even provide them free in hardship situations.

An x86-64 UNIX desktop can be used for the out-of-class work.

The Engineering Linux Labs are also available. You will need an Engineering account (separate from your PSU Odin account) to use the Engineering Linux Labs. If you don’t already have an account, go to the CAT new student page for more information.

The Linux Labs are located in FAB 88-09 and 88-10 as well as by remotely using ssh to babbage.cs.pdx.edu and ada.cs.pdx.edu.

Academic Honesty

If you do something that violates the University's or the Department's Student Conduct code, you will be given a zero on the affected work and the incident will be reported to the Department and to the University.

In particular, you may not plagiarize (use other people's ideas, text, or code without giving them credit). If you have questions, please contact me and we'll talk.