COMP 235: Introduction to Systems Programming, Fall 2022

This syllabus is subject to change based on specific class needs, especially the schedule. Significant deviations will be discussed in class. Individual exceptions to the policies and schedule are granted only in cases of true emergency. Please make arrangements with me if an emergency arises.

Logistics

Content

Description

An introduction to low-level programming and computer hardware organization form a software perspective. The emphasis is on understanding how application programmers can use knowledge of the entire system to write better programs. Students will learn about data representation, machine language, the memory hierarchy, and virtual memory through programming assignments in C and assembly language. Further topics may include processor architecture, code optimization, and concurrency.

Basically, the aim of this course is to (1) convince students that no magic is required to make computers work, and (2) help students understand how hardware decisions can affect their programs.

Sources

The course textbook will be:

We will also be using parts of Dive into Systems, a free, online textbook.

Since we will be using a lot of C, some of you may wish to have a more in-depth reference manual. The following is pretty good:

However, you may be able to get by with online documentation only:

Other sources will be posted on this webpage as needed.

Topics

The goal of this course is to produce programmers who understand how the correctness and performance of their applications are impacted by the compilation system, operating system, and hardware. After dedicating some time to learning C, the course aims to cover the majority of chapters 1-9 of the text.

- Basics of C - Memory Hierarchy
- Tour of Systems - Linking
- Data Representations - Exceptional Control Flow (as time allows)
- Machine Language - Virtual Memory
- Code Optimization - Processor Architecture (as time allows)
- x86 Assembly Language - Dynamic Memory

Programming Environment

This course involves programming in both C and assembly language. All necessary tools will be available on the department server. All software for this course is available free of charge and can be found on the web if students wish to install it on their personal machines. The instructor cannot guarantee support for installing and using other development environments.

Assessment

Assignments and Workload

The weekly workload for this course will vary by student and by week but should be about 12 hours per week on average. The following table provides a rough estimate of the distribution of time over different course components for a 16 week semester, as well as detailing the type, amount, and relative value of all assignments.

Category Amount Final Grade Weight Total Time Time/Week (Hours)
Lectures 41 10% (Participation) - 2.5
Programming Assignments 5-7 30% 48 4
Homework 6-8 25% 32 2.5
Exam Study - - 16 1
Exams 2 35% - -
Reading+Unstructured Study - -   2
        12

Each exam (midterm and final) focuses primarily, but not necessarily exclusively, on material covered since the previous exam. In other words, the final exam may include a few questions from first-half material. The midterm and final are weighted equally (17.5% of your final grade). Your lowest homework score and programming assignment score will be dropped (separately).

Grading

Your participation grade is based on a variety of activities. During class I will often make use of the Socrative app, so you’ll need to install this on your phones. Participating in Socrative questions and with in-class group activities is required for a decent participation grade; an A includes asking questions either in class or in office hours.

An additional portion of your participation grade is based on your homework presentations. Every day that a homework assignment is due, one or more students will be randomly selected to present their solution to a portion of the assignment. You will be graded based on preparation and the thoroughness of your explanations, NOT on correctness, although you should of course strive for correctness. Students taking late days will be required to leave the classroom during these presentations. You must inform me BEFORE class if you are taking late days to avoid being randomly selected to present. Otherwise, if you are randomly selected to present but have not done the assignment, you will receive a 0.

Your final grade is based on a weighted average of particular assignment categories. You can estimate your current grade based on your scores and these weights. You may always visit the instructor outside of class to discuss your current standing. Assignments and final grades use a standard grading scale shown below and will not be curved except in rare cases when deemed necessary by the instructor.

This courses uses a standard grading scale. Assignments and final grades will not be curved except in rare cases when its deemed necessary by the instructor. Percentage grades translate to letter grades as follows:

Score Grade
94–100 A
90–93 A-
88–89 B+
82–87 B
80–81 B-
78–79 C+
72–77 C
70–71 C-
68–69 D+
62–67 D
60–61 D-
0–59 F

You are always welcome to challenge a grade that you feel is unfair or calculated incorrectly. Mistakes made in your favor will never be corrected to lower your grade. Mistakes made not in your favor will be corrected. Basically, after the initial grading your score can only go up as the result of a challenge*.

You are always welcome to challenge a grade that you feel is unfair or calculated incorrectly. Mistakes made in your favor will never be corrected to lower your grade. Mistakes made not in your favor will be corrected. Basically, after the initial grading your score can only go up as the result of a challenge.

Policies

Schedule

The following tentative calendar should give you a feel for how work is distributed throughout the semester. Assignments and events are listed in the week they are due or when they occur. This calendar is subject to change based on the circumstances of the course.

Note: CSAPP = Computer Systems, A Programmer’s Perspective, DIS = Dive into Systems

Date Topic Assignment/Reading
Wed 08/24 (Week 1) Intro and Logistics  
Fri 08/26 The Command Line DIS 0 and this, Hwk 1
Mon 08/29 (Week 2) Intro to C DIS 1, Prog 1
Wed 08/31 More C through Exercises  
Fri 09/02 Program 1 Walkthrough Prog 2
Mon 09/05 (Week 3) Pointers DIS 2.1-2.3
Wed 09/07 Dynamic Memory; Arrays DIS 2.4-2.5
Fri 09/09 Strings; Structs; I/O DIS 2.6-2.8
Mon 09/12 (Week 4) Debugging DIS 3
Wed 09/14 A Tour of Computer Systems CSAPP 1, Hwk 2
Fri 09/16 Amdahl’s Law; Prog 1/2 Review  
Mon 09/19 (Week 5) Data Representation and Bit Operations CSAPP 2.1
Wed 09/21 Bit Operations II Prog 3 (Data Lab)
Fri 09/23 Integer Representations CSAPP 2.2
Mon 09/26 (Week 6) Integer Arithmetic CSAPP 2.3
Wed 09/28 Floating Point I CSAPP 2.4
Fri 09/30 Floating Point II  
Mon 10/03 (Week 7) Datalab Questions  
Wed 10/05 Floating Point Arithmetic CSAPP 3.1-3.4
Fri 10/07 ML: Basics I CSAPP 3.5,
Mon 10/10 (Week 8) Bomb Lab Tips Prog 4 (Bomb Lab)
(Wed 10/12) (Fall Break)  
(Fri 10/14) (Fall Break)  
Mon 10/17 (Week 9) ML: Control (Branching) CSAPP 3.6
Wed 10/19 ML: Control (Loops)  
Fri 10/21 (Midterm Take-Home Exam)  
Mon 10/24 (Week 10) (Midterm Take-Home Exam)  
Wed 10/26 (Midterm Take-Home Exam)  
Fri 10/28 Midterm Solutions  
Mon 10/31 (Week 11) Bomblab Questions  
Wed 11/02 ML: Procedures CSAPP 3.7
Fri 11/04 ML: Procedures II: Recursion  
Mon 11/07 (Week 12) (no class)  
Wed 11/09 ML: Data 3.8,3.9,3.11*, Hwk 3
Fri 11/11 Buffer Overflows 3.10
Mon 11/14 (Week 13) Memory Hierarchy I CSAPP 6.1-6.3
Wed 11/16 Memory Hierarchy II  
Fri 11/18 Caches CSAPP 6.4-6.7
Mon 11/21 (Week 14) Performance Impact of Caches  
(Wed 11/23) (Thanksgiving Break)  
(Fri 11/25) (Thanksgiving Break)  
Mon 11/28 (Week 15) Virtual Memory CSAPP 9, Hwk 4, Prog 5 (Malloc Lab)
Wed 11/30 Tracing Virtual Memory  
Fri 12/02 Basic Heap Allocation Strategies  
Mon 12/05 (Week 16) Advanced Malloc Implementations  
Wed 12/07 Malloc Lab Tips/Debugging  
Tue 12/13 8:00 AM Final Exam  

Monmouth College Services

Student Learning Outcomes

This course covers a variety of knowledge areas as categorized by the ACM/IEEE-CS Task Force on Computing Curricula. Note that not all of these areas are introduced in this course; some are touched upon previously and others will be developed further in later courses. At the end of the course, students should achieve the following learning outcomes with the specific level of mastery:

Knowledge Unit Learning Outcome with Level of Mastery
AL/Basic Analysis - Perform empirical studies to validate hypotheses about runtime stemming from
  mathematical analysis. Run algorithms on input of various sizes and compare performance. [Assessment]
AR/Digital Logic and - Describe the progression of computer technology components from vacuum tubes
Digital Systems to VLSI, from mainframe computer architectures to the organization of warehouse-scale computers. [Familiarity]
  - Describe the progression of computer technology components from vacuum tubes
  to VLSI, from mainframe computer architectures to the organization of warehouse-scale
  computers. [Familiarity]
  - Comprehend the trend of modern computer architectures towards
  multi-core and that parallelism is inherent in all hardware systems. [Familiarity]
  - Explain the implications of the “power wall” in terms of further processor
  performance improvements and the drive towards harnessing parallelism. [Familiarity]
AR/Machine Level - Explain why everything is data, including instructions, in computers. [Familiarity]
Representation of Data - Explain the reasons for using alternative formats to represent
  numerical data. [Familiarity]
  - Describe how negative integers are stored in sign-magnitude and
  twos-complement representations. [Familiarity]
  - Explain how fixed-length number representations affect accuracy and
  precision. [Familiarity]
  - Describe the internal representation of non-numeric data, such as
  characters, strings, records, and arrays. [Familiarity]
  - Convert numerical data from one format to another. [Usage]
  - Write simple programs at the assembly/machine level for string
  processing and manipulation. [Usage]
AR/Assembly Level - Explain the organization of the classical von Neumann machine and
Machine Organization its major functional units. [Familiarity]
  - Describe how an instruction is executed in a classical von Neumann machine, with
  extensions for threads, multicore synchronization, and SIMD execution. [Familiarity]
  - Describe instruction level parallelism and hazards, and how they are
  managed in typical processor pipelines. [Familiarity]
  - Summarize how instructions are represented at both the machine level
  and in the context of a symbolic assembler. [Familiarity]
  - Demonstrate how to map between high-level language patterns into
  assembly/machine language notations. [Familiarity]
  - Explain different instruction formats, such as addresses per instruction and
  variable length vs. fixed length formats. [Familiarity]
  - Explain how subroutine calls are handled at the assembly level. [Familiarity]
  - Explain the basic concepts of interrupts and I/O operations. [Familiarity]
  - Write simple assembly language program segments. [Usage]
  - Show how fundamental high-level programming constructs are
  implemented at the machine-language level. [Usage]
AR/Memory System - Explain the effect of memory latency on running time. [Familiarity]
Organization and - Describe how the use of memory hierarchy (cache, virtual memory) is
Architecture used to reduce the effective memory latency. [Familiarity]
  - Describe the principles of memory management. [Familiarity]
  - Explain the workings of a system with virtual memory managements. [Familiarity]
  - Compute Average Memory Access Time under a variety of cache and
  memory configurations and mixes of instruction and data references. [Usage]
AR/Multiprocessing and - Discuss the concept of parallel processing beyond the classical von Neumann model.]
Alternative - Describe alternative parallel architectures such as SIMD and MIMD. [Familiarity]
Architectures - Discuss the special concerns that multiprocessing systems present with
  respect to memory management and describe how these are addressed. [Familiarity]
OS/Operating System - Describe how computing resources are used by application software
Principles and managed by system software. [Familiarity]
  - Contrast kernel and user mode in an operating system. [Usage]
OS/Memory - Explain memory hierarchy and cost-performance trade-offs. [Familiarity]
Management - Summarize the principles of virtual memory as applied to caching and paging. [Familiarity]
  - Evaluate the trade-offs in terms of memory size (main memory, cache
  memory, auxiliary memory) and processor speed. [Assessment]
  - Defend the different ways of allocating memory to tasks, citing the
  relative merits of each. [Assessment]
  - Describe the reason for and use of cache memory (performance and
  proximity, different dimension of how caches complicate isolation
  and VM abstraction). [Familiarity]
  - Discuss the concept of thrashing, both in terms of the reasons it
  occurs and the techniques used to recognize and manage the problem. [Familiarity]
OS/System Performance - Describe the performance measurements used to determine how a system
Evaluation performs. [Familiarity]
  - Explain the main evaluation models used to evaluate a system. [Familiarity]
SDF/Development - Identify common coding errors that lead to insecure programs (e.g.,
Methods buffer overflows, memory leaks, malicious code) and apply strategies
  for avoiding such errors. [Usage]
SF/Evaluation - Explain how the components of system architecture contribute to
  improving its performance. [Familiarity]
  - Describe Amdahl’s law and discuss its limitations. [Familiarity]
  - Design and conduct a performance-oriented experiment. [Usage]
  - Use software tools to profile and measure program performance. [Assessment]