Bryn Mawr College
CMSC 246: Systems Programming
Prof. Deepak Kumar
|Texts||Important Dates||Assignments||Lectures||Course Policies||Links|
202 Park Science Building
dkumar at brynmawr dot edu
Lecture Hours: Mondays & Wednesdays 1:10p to 2:30p
Room: Room 336 Park Science Building
Lab: Mondays 2:40p to 4:00p in Room 231 (Attendance in Lab is REQUIRED)
(additional lab hours will also available, see below).
Office Hours: Tuesdays, 1:30-2:30p & Wednesdays, 10a to 11:00a, or by appointment.
Lab Assistants: The following Lab assistants will be available during the week (names and schedules will be posted by the end of this week) for assistance on lab assignments.
Course Description: This is a course in systems programming using the C programming language in the Linux environment. C undergirds the world of modern computers and runs on anything. Learning C will also teach you how a computer really works under the hood and it will power your knowledge of programming and system building on any platform.
A secondary goal of this course is to give you a chance to learn some fundamental technologies in widespread use. As a computer scientist, you will be expected to know about Makefiles, version control, and command-line execution in the Linux environment.
By the end of this course, you will be able to…
- Write standalone programs in the C programming language
- Understand computer memory management and pointers
- Work with linked structures (lists, trees, and graphs)
- Use the Linux command line
- Become familiar with programming tools and environment in Linux
During the course, you will…
- Code lots of C programs
- Setup and use Make files, and other Linux tools
- Learn how to debug
In order to learn any programming skill, you must simply do it. Reading a book or watching me code will not help you get better. This course is thus programming-intensive. You will be expected to spend a significant amount of time weekly (6-8 hours) outside of class programming to complete the homework assignments. If you run into a snag, the programming burden may prove to be even higher. Of course, programming is fun, so the time should fly by.
Class time in CS246 will be spent primarily working with peers to solve small programming problems, conduct peer reviews, and complete other exercises. It is expected that you complete the reading before class and come with questions; I will try to avoid spending large chunks of class time repeating what the book says so well.
January 22: First lecture
February 21: Exam 1
April 2: Exam 2
May 2: Exam 3
- Assignment#1 (Due on Wed, January 31): Click here for details.
- Assignment#2 (Due on Wed, Feb 7): Click here for details.
- Assignment#3 (Due on Wednesday, Feb 14):Click here for details.
- Assignment#4 (Due in class on Monday, February 19):Click here for details.
- Assignment#5 (Due on Wednesday, March 7): Click here for details.
- Assignment#6 is posted (Due on Monday, March 26): Click here for details.
- Assignment#7 is posted (Due on Monday, April 2): Click here for details.
- Assignment#8 is posted (Due on Wednesday, April 18):Click here for details.
- Assignment#9 is posted (Due Monday, April23) Click here for details.
- Assignment#10 is posted (Due Monday, April30) Click here for details.
- Week 1 (January 22, 24)
January 22: Introduction & administrivia. Meeting Linux & C: WIMP vs CLI, basic shell commands. a brief history of the evolution of C, a quick overview of C (aka C for Java programmers), writing, compiling, and running C programs.
Lecture slides:Overview of the course and the C language.
Lab: We will have a lab today. A printed handout will be given in the lab. Agenda: Getting familiar with the Linux command line (BASH): ls, pwd, cd, cp, cat, less, more, mv. Creating and editing text/program files: vi/vim, emacs, Atom. Writing, compiling, and running C programs (several!).
Read: Chapters 1-6 from King. Chapters 1-4 from Shotts.
January 24: Overview of C: Printf() and scanf(), conditionals and loops. Writing basic C programs.
Lecture Slides: printf(), scanf(), Writing C programs.
Assignment#1 (Due on Wed, January 31): Click here for details.
Read: Chapters 1-6 from King. Chapters 1-4 from Shotts.
- Week 2 (January 29, 31)
January 29: Linux: command line arguments, built-in shell commands vs. executables (type, which), getting help (help, --help, man, appropos, whatis, info), pipes and i/o redirection. C:expressions, assignment (l-value, r-value), compound assignment, increment/decrement operators, conditional expression, Booleans in C, basic types (int, float, char, short, long, unsigned), type conversions (promotion, casting), characters in C.
Read: Chapter 5 from Shotts, Chapter 7 from King.
Lab2: Exploring sizes of types (sizeof()), pushing counting loops to int boundary, program to compute days between dates.
January 31: Linux: I/O redirection, filters (sort, uniq, wc, grep). C: Computing leap years. Expressions, assignment (l-value, r-value), compound assignment, increment/decrement operators, conditional expression, Booleans in C. The char type in C. Arrays.
Read: Chapter 6 from Shotts and Chapters 8 & 9 from King.
Assignment#2 (Due on Wed, Feb 7): Click here for details.
- Week 3 (February 5, 7)
February 5: Conditional Expressions, <ctype.h> library and its functions, 1 & 2-dimensional arrays.
Read: Chapter 8 from King.
Lab3: Computing & printing histograms, computing letter frequency counts (using char I/O & <ctype.h>.
February 7: Functions, arrays as parameters. Crash course on composing & writing functions.
Assignment#3 (Due on Wednesday, Feb 14):Click here for details.
- Week 4 (February 12, 14)
February 12: Variables: Scope & lifetime/extent. Passing arrays to functions as parameters. Variable length arrays as parameters. Bootcamp: Developing a program to process 2-D arrays.
Read: Chapters 9 and 10 from King.
Lab 4: Simulating the Fifteen Puzzle (more 2-D array practice).
February 14: 2-D Arrays. Pointers: pointer variables, reference operator (&), dereference operator (*), pointers as parameters (call-by-reference).
Read: Chapter 11 from King. read Chapters 7&8 from Shotts.
Assignment#4 (Due in class on Monday, February 19):Click here for details.
- Week 5 (February 19, 21)
February 19: Program memory types: static, automatic, dynamic. Pointers & Reference operators: Declaring pointer variables, dereference/indirection operator (*), NULL pointer, Passing parameters by reference using pointers. Examples.
Read: Chapter 11 from King.
Lab 5: Review for Exam 1. Bring your questions.
February 21: Exam 1 is today.
- Week 6 (February 26, 28)
February 26: Pointers & Arrays. Using pointer arithmetic. Linux: Commands for secirity & Privacy.
Read; Chapter 12 from King. Chapter 9 from Shotts.
Lab 6: Writing programs for some Exam 1 questions.
February 28: 2-D arrays storage: row-major and column-major form. Using pointers to index 2-D arrays. Strings: literals, variables, NULL terminated strings. The <string.h> library.
NOTE: March 1 (Thursday) TA Hours will be from 8;00 to 10:00p due to the CS Talk.
Read: Chapter 13 from King.
Assignment 5 is posted (Due on Wednesday, March 7): Click here for details.
- Week 7 (March 5, 7)
March 5: The C Preprocessors. Simple and parameterized macros. Conditional compilation (gcc flags -E, and -D). Examples of macros.
Lab 7: Counting word frequencies in text files. Combining processing with Linux commands/utilities, redirection and pipes.
Read: Chapter 14 from King.
March 7: No class due to Snow Storm!
- Week 8 (March 12, 14)
No Classes. Spring Break
- Week 9 (March 19, 21)
March 19: Structures in C. Using OOP design ideras to design using structures (Back to the future, again!), File I/O, Command line arguments, parsing CSV files (using strtok()).
Read: Section 13.7, Chapter 16, Sections 22.2-5 from King. Chapter 20 from Shotts.
Lab 8: Airports! (File I/O, Command line arguments, structures, parsing CSV data files).
Assignment#6 is posted (Due on Monday, March 26): Click here for details.
March 21: No class due to yet another snow storm.
- Week 10 (March 26, 28)
March 26: Designing program using multiple source files. How to orgamize large programs: header files, and source files. Separate compilation. Introduction to make files.
Read: Chapter 15 from King.
Lab 9: Project management with make files.
Assignment#7 is posted (Due on Monday, April 2): Click here for details.
March 28: Implementing a Stack data type using structs. Memory organization for program execution, increasing resource limits in Linux shell, dynamic memory allocation using malloc().
Read: Chapter 17 from King (justthe initial part that introduces malloc()).
- Week 11 (April 2, 4)
April 2: Exam 2 is today. No Lab today due to exam.
April 4: Dynamic Memory Management in C using malloc(), calloc(), realloc(), and free().
Read: Chapter 17 from King.
- Week 12 (April 9, 11)
April 9: Dynamic memory management in C. Implementing linked lists in C (Java Style!).
Read: Chapter 17 from King.
Assignment#8 is posted (Due on Wednesday, April 18):Click here for details.
April 11: Linked Lists ic C, contd: Designing & writing Iterators. Generic Linked Lists. Function pointers.
Read: Chapters 18 & 19 from King.
- Week 13 (April 16, 18)
April 16:Generic linked lists in C. using function pointers to pass (and call) function parameters. Designing (large) programs. Discrete Event Simulation of an airline check-in hall: How to design, and when and how to write code. Using unit testing to text modules.
NOTE:: Deepak's Office Hours for Tuesday, April 17 are moved to 12:00-1:00p due to a doctor's appointment.
Read: Chapters 18 & 19 from King.
Assignment#9 is posted (Due Monday, April23) Click here for details.
April 18: Errors! How to deal with them. Types of errors - syntax errors, logical errors. Run time errors - Segmentation Fault, Stack smashed, Bus error. Some tools: assert(), DEBUG macro, Debugger (gdb).
Debugging Starter (Kit): Click here.
- Week 14 (April 23, 25)
April 23: Reviewing Assignment#8, and #9. Building on the design of #9 to complete the DES program. Implementing other data structures in C: Binary Trees, Graphs, etc.
Assignment#10 is posted (Due Monday, April30) Click here for details.
April 25: Integer data in C. Base-10 (decimal), Base-2 (binary), Base-8 (octal), and Base-16 (hexadecimal) number representations. 2's complement representation of negative integers. C's syntax for octal and hexadecimal values. Bitwise operations in C: left-shift (<<), right-shift (>>), bitwiSE-AND (&), bitwise-OR (|), bitwise-XOR (^), and bitwise-NOT (~). Low-level programming in C. Example of a bit-algorithm: Huffman Encoding for data compression.
Read: Chapter 20 from King.
- Week 12 (April 30, May 2)
April 30: Review for Exam. Bring questions!
Office Hours for Monday, April 30: 2:30-3:45p.
Office Hours for Tuesday, May 1: 1:00 to 2:30p.
Office Hours for Wednesday, May 2: 10:00a to 11:00a and 12:10p to 1:00p.
May 2: Exam 3 is today.
Attendance and active participation are
expected in every class. Participation includes asking questions,
contributing answers, proposing ideas, and providing constructive
As you will discover, I am a proponent of two-way communication and I welcome feedback during the semester about the course. I am available to answer questions, listen to concerns, and talk about any course-related topic (or otherwise!). Come to office hours! This helps me get to know you. You are welcome to stop by and chat. There are many more exciting topics to talk about that I won't have time to cover in-class.
Please stay in touch with me, particularly if you feel stuck on a topic or assignment and can't figure out how to proceed. Often a quick e-mail, phone call or face-to-face conference can reveal solutions to problems and generate renewed creative and scholarly energy. It is essential that you begin assignments early.
There will be 6-8 assignments,
weighted equally in the final grading (see below). Assignments must be
submitted according to the instructions provided in each assignment.
At the end of the semester, final grades will be calculated as a weighted average of all grades according to the following weights:
Exam 1: 20%
Exam 2: 20%
Exam 3: 20%
Lab Attendance: 10%
Incomplete grades will be given only for verifiable medical
illness or other such dire circumstances.
Technology in the classroom
The class meetings/lectures will be a place to learn the concepts that are a part of the syllabus. I will, in the course of a lecture, write code on the board, and/or even do some live coding in class. The objective of this is to illustrate to you how to go about applying the concepts in practice. It is NOT a place for you to open your laptops and start to code with me. In fact, you are encouraged NOT to bring your laptops to class to use them for any purpose. It is distracting to other students. Phone (smart or otherwise) and tablet use during class meetings is also strongly discouraged. Listen, understand, ask questions, and take notes in a notebook if you need to. You will learn more! Yyou will be doing coding in the labs under my supervision.
The assignments in this course are a place for you to exercise your learning of the concepts and apply them in actual working programs. The best way to get the most of of this course is to try out and code the concepts learned in the class (outside the class!). Do not be afraid to try things! This will improve your understanding and raise questions that you should feel free to bring forward in class. A quick word of advice: stay abreast of the material covered in class, and start your assignments on the day they are announced.
ALL work submitted for grading should be entirely YOUR OWN. Sharing of programs, code snippets, etc. is not permitted under ANY circumstances.
Submission, Late Policy, and Making Up Past WorkAll work must be turned in either in hard-copy or electronic submission, depending on the instructions given in the assignment. E-mail submissions, when permitted, should request a "delivery receipt" to document time and date of submission. Extensions will be given only in the case of verifiable medical excuses or other such dire circumstances, if requested in advance and supported by your Academic Dean.
There will be three exams in this course. The exams will be closed-book and closed-notes. The exams will cover material from lectures, homeworks, and assigned readings.
I encourage you to discuss the material and work together to understand it. Here are some thoughts on collaborating with other students:
Created on January 3, 2018.