Course Information


This course gives a solid understanding of the principles and abstractions used in computer systems and machine programs using C. Towards this aim, it covers a broad range of topics, providing students with an in-depth perspective and programming experience regarding the basic topics of C language and how programs are formed and executed at the microprocessor-level.

Upon the completion of COMP201, student will be able to (1) demonstrate proficiency in writing C programs that require effective memory management, (2) gain a deep knowledge of the compilation flow and runtime behavior of C programs, (3) have a clear understanding of computer arithmetic in a modern computing system, (4) recognize the relationship between a C program and its assembly translation, and (5) gain a general sense of working in a Unix environment as a power user, getting familiar with shell tools, version control systems, compilers, debuggers, profilers.

The course is taught by Aykut Erdem - the teaching assistants are Ahmed Imam Shah, Amir Mohamad Akhlaghi Gharelar, Farzin Negahbani , Mandana Bagheri Marzijarani, Muhammad Aditya Sasongkoand, and Samet Demir.


Time and Location

Lectures: Monday, Wednesday, Friday at 14:00-14:50 online via Zoom)
Labs: Monday (Lab A), Wednesday (Lab B) at 19:00-19:50, Thursday (Lab C) at 20:00-20:50 (online via Zoom)

Reference Books

Policies: All work on assignments must be done individually unless stated otherwise. You are encouraged to discuss with your classmates about the given assignments, but these discussions should be carried out in an abstract way. That is, discussions related to a particular solution to a specific problem (either in actual code or in the pseudocode) will not be tolerated.

In short, turning in someone else’s work, in whole or in part, as your own will be considered as a violation of academic integrity. Please note that the former condition also holds for the material found on the web as everything on the web has been written by someone else.


The course webpage will be updated regularly throughout the semester with lecture notes, presentations, assignments and important deadlines. All other course related communications will be carried out through Blackboard.


COMP201 is open to second-year undergraduate students. Non-COMP students should ask the course instructor for approval before the add/drop period. The prerequisites for this course is COMP 132 - Advanced Programming.

Course Requirements and Grading

Grading will be based on


Date Topic Notes
Oct 5 Introduction. Course logistics (slides) (video) Additional Reading:
The Strange Birth and Long Life of Unix, Warren Toomey, IEEE Spectrum, 28 Nov 2011
“A damn stupid thing to do”—the origins of C, Arstechnica
Oct 7 A tour of C programs, Bits and Bytes (slides) (code) (video)
Assg0 out: Getting Started with Unix and C
B&O 1
Oct 9 Representing and Operating on Integers (slides) (code) (video) B&O 2.2-2.3

Additional Readings:
Oct 5,7,8 Bootcamp: Programming with C (slides) (video)
Oct 12 Bits and Bitwise Operators (slides) (code) (video) B&O 2.1
Oct 14 Floating point (slides) B&O 2.4
Additional Reading: What Every Computer Scientist Should Know About Floating-Point Arithmetic, David Goldberg, ACM Computing Surveys, 23(1), 1991

Oct 16 More floating point (slides) (code) (video)
Assg0 in, Assg1 out: Manipulating Bits
B&O 2.4
Oct 12,14,15 Lab 1: The Linux Shell (slides) MIT MS The Shell
Stanford CS107 Unix videos 1-15, 24, 25
Oct 19 Chars and Strings in C (slides) (code) (video) K&R 1.9, 5.5, Appx B3
Oct 21 More Strings in C, Pointers (slides) (code) (video) K&R 5.1, Essential C 3 (strings and string.h library functions)
Oct 23 Strings in Memory (slides) (code) K&R 1.6, 5.5, Essential C 3 (The mechanics of pointers and arrays)
Oct 19,21,22 Lab 2: Bits, Ints and Floats, Vim (slides) MIT MS Editors (Vim)
Stanford CS107 Unix videos 28
Oct 26 Arrays and Pointers (slides) (code) (video) K&R 5.2-5.5, Essential C 6 (Advanced pointers)
Oct 28 No class (Republic Day)
Assg1 in, Assg2 out: Strings in C
Oct 30 The Stack and The Heap (slides) (video) K&R 5.6-5.9, Essential C 6 (The heap)
Oct 26,28,29 No labs this week (Republic Day)
Nov 2 Other Heap Allocations, realloc (slides) (code) (video) K&R 5.6-5.9, Essential C 6 (The Heap)
Nov 4 Generics (slides) (code) (video) K&R 5.6-5.9, Essential C 6 (The Heap)
Nov 6 Function Pointers (slides) (code) (video) K&R 5.11
Nov 2,4,5 Lab 3: C-Strings and Valgrind (slides) Stanford CS107 Unix videos 26
Nov 9 More Function Pointers, const (slides) (code) (video) K&R 5.11, A1
Nov 11 Structures (slides) (code) (video)
Assg2 in, Assg3 out: Heap Management
K&R 6.1-6.7
Nov 13 Compiling C programs (slides) (code) (video) Stanford Unix Programming Tools 1
Nov 9,11,12 Lab 4: Arrays/Pointers and GDB (slides) Stanford CS107 Unix videos 27
Harvard CS50 short on GDB
Nov 16 Intro to x86-64 (slides) (code) (video) B&O 3.1-3.3
Additional reading:
An Introduction to 64-bit Computing and x86-64,
Jon Stokes,, 2002
Nov 18 Data Movement (slides) (video) B&O 3.4
Additional reading:
The story of Mel (Annotated version)
Nov 20 Arithmetic and Logic Operations (slides) (video) B&O 3.5
Nov 16,18,19 Lab 5: Working with multiple files, writing your own Makefiles (slides)
Nov 23 Assembly Execution and %rip (slides) (video) B&O 3.6.1-3.6.2
Nov 25 x86-64 Control Flow (slides) (video) B&O 3.6.3-3.6.8
Nov 27 More Control Flow (slides) (video)
Assg3 in, Assg4 out: Defusing a Binary Bomb
B&O 3.6.3-3.6.8
Nov 23,25,26 Lab 6: Machine Programming with Assembly (slides)
Nov 30 x86-64 Procedures (slides) (video) B&O 3.7
Dec 2 More x86-64 Procedures (slides) (code) B&O 3.7
Dec 4 Data and Stack Frames (slides) (video) B&O 3.8-3.9
Nov 30, Dec 2,3 No lab this week
Dec 5 Midterm Exam (11:45am) (Midterm Exam Guide)
Dec 7 Security Vulnerabilities (slides) (video) B&O 3.10
Additional Reading: Smashing the Stack for Fun and Profit, Aleph One
Dec 9 Buffer Overflow Exploits, Storage Technologies (slides) (code) (video) B&O 6.1
Dec 11 Locality, The Memory Hierarchy (slides) (video)
Assg4 in
B&O 6.2-6.3
Dec 7,9,10 Lab 7: Runtime Stack (slides)
Dec 14 No class - Winter break
Dec 16 No class - Winter break
Dec 18 No class - Winter break
Dec 14,16,17 No lab this week - Winter break
Dec 21 Cache Memories (slides) (code) (video)
Assg5 out: Buffer Overflow Attacks
B&O 6.4-6.7
Cache Simulator
Dec 23 Debugging and Design (slides) (video)
Dec 25 Code Optimization (slides) (code) (video) B&O 5
Dec 21,23,24 No lab this week
Dec 28 Linking (slides) (video) B&O 7
Dec 30 No class - New years day
Jan 1 No class - New years day
Dec 28,30,31 No lab this week
Jan 4 Managing The Heap (slides) (video)
Assg6 out
B&O 9.9
Jan 6 More on Managing The Heap (slides) (video)
Assg5 in
B&O 9.9
Jan 8 Wrap-up (slides) (video)
Jan 4,6,7 Lab 8: Memory organization (slides)
Jan 19 Final Exam (6:15pm) (Final Exam Guide)