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, Ali Kerem Bozkurt, Deniz Bilge Akkoc, Enes Sanli.
Lectures: Tuesday, Thursday at 14:30-15:40 (SNA B142)
Labs: Tuesday at 16:00-17:40 (Lab A) (SNA B242), Thursday at 16:00-17:40 (Lab B) (SNA B242)
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.
Grading will be based on
| Date | Topic | Notes |
| Oct 6 | Introduction. Course logistics, A tour of C programs (slides) (code) | B&O 1 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 8 | Bits and Bytes, Representing and Operating on Integers (slides) (code) | B&O 2.2-2.3 Additional Readings:
|
| Oct 6-8 | No labs this week | |
| Oct 13 | Bits and Bitwise Operators (code) | B&O 2.1 |
| Oct 15 | Floating point (code) | B&O 2.4 Additional Reading: What Every Computer Scientist Should Know About Floating-Point Arithmetic, David Goldberg, ACM Computing Surveys, 23(1), 1991 Demos: |
| Oct 16 | Bootcamp: Programming with C and Git basics | |
| Assg0 out: Getting Started with Unix and C | ||
| Oct 20 | Chars and Strings in C (code) | K&R 1.9, 5.5, Appx B3 |
| Oct 22 | More Strings, Pointers (code) | K&R 1.6, 5.5, Essential C 3 (strings and string.h library functions, The mechanics of pointers and arrays) |
| Oct 20-22 | Lab 1: The Linux Shell | MIT MS The Shell Stanford CS107 Unix videos 1-15, 24, 25 |
| Assg0 in, Assg1 out: Strings in C | ||
| Oct 27 | Arrays and Pointers (code) | K&R 5.2-5.5, Essential C 6 (Advanced pointers) |
| Oct 29 | No classes - Republic Day | |
| Oct 6-8 | No labs this week | |
| Nov 3 | The Stack and The Heap | K&R 5.6-5.9, Essential C 6 (The heap) |
| Nov 5 | Realloc, Memory Bugs (code) | K&R 5.6-5.9, Essential C 6 (The Heap) |
| Nov 3-5 | Lab 2: C-Strings and GDB | Stanford CS107 Unix videos 26< |
| Assg1 in | ||
| Nov 10 | void *, Generics (code) | K&R 5.6-5.9, Essential C 6 (The Heap) |
| Nov 12 | Function Pointers (code) | K&R 5.11 |
| Nov 10-12 | Lab 3: Arrays, Pointers, and Valgrind | Stanford CS107 Unix videos 27 Harvard CS50 short on GDB |
| Assg2 out: Heap Management | ||
| Nov 17 | const, Structures (code) | K&R 6.1-6.7 |
| Nov 19 | Compiling C programs (code) Assg2 in |
Stanford Unix Programming Tools 1 |
| Nov 17-19 | No labs this week | |
| Nov 20 | Lab Exam 1 | |
| Nov 24 | Introduction to x86-64, Data Movement (code) | B&O 3.1-3.4 Additional reading:
|
| Nov 26 | Arithmetic and Logic Operations | B&O 3.5-3.6 |
| Nov 24-26 | Lab 4: Structs, Working with multiple files, writing your own Makefiles | |
| Assg2 in | ||
| Dec 1 | x86-64 Control Flow | B&O 3.6.1-3.6.2 |
| Dec 3 | Midterm Review | |
| Dec 1-3 | No labs this week | |
| TBA | Midterm Exam | |
| Dec 8 | More Control Flow | B&O 3.6.3-3.6.8 |
| Dec 10 | x86-64 Procedures (code) | B&O 3.7 |
| Dec 8-10 | No labs this week | |
| Assg3 out: Defusing a Binary Bomb | ||
| Dec 15 | Data and Stack Frames | B&O 3.8-3.9 |
| Dec 17 | Security Vulnerabilities (code) | B&O 3.10 Additional Reading: Smashing the Stack for Fun and Profit, Aleph One |
| Dec 15-17 | Lab 5: Machine Programming with Assembly | |
| Dec 22 | Cache Memories | B&O 6.1-6.4.2 |
| Dec 24 | More Cache Memories | B&O 6.4-6.7 Demos: Cache Simulator |
| Dec 22-24 | No labs this week | |
| Assg3 in, Assg4 out: Buffer Overflow Attacks | ||
| Dec 25 | Lab Exam 2 | |
| Dec 29 | Optimization (code) | B&O 5 |
| Dec 31 | No classes - New Year's Eve | |
| Dec 22-24 | No labs this week | |
| Jan 5 | Linking | B&O 7 |
| Jan 7 | Wrapping Up | |
| Jan 5-7 | Lab 6: Runtime Stack | |
| Assg4 in | ||
| TBA | Final Exam (Final Exam Guide) |