In Class
What we work through together in class, so you can read it off your own screen instead of the board.
Nothing on these pages is graded and nothing on them is handed in. The work you submit is on Assignments instead — a different list, a different page, and the only one with a deadline on it. These pages are the practice for those; they are not a smaller version of them.
One page per class, newest first. During class, open the one at the top of this list and keep it open — it is the spec for whatever we are doing, and it is there so you can re-read a step instead of asking me to repeat it.
| Title | Description |
|---|---|
| Class 24 — Tuesday, November 17 | Twelve threads you started add up the numbers below a hundred million into one sum and lose nine tenths of it; a mutex makes them take turns, placed three ways with three very different times; and two locks taken in two orders stop a program for good. |
| Class 23 — Thursday, November 12 | Threads started by hand: pthread_create and pthread_join, and a struct for each thread with its own share of the work. |
| Class 22 — Tuesday, November 10 | Twelve threads adding to one count lose some of the additions: a data race, and two ways to fix it, taking turns and each thread counting its own. |
| Class 21 — Thursday, November 5 | Twelve threads at once, and one line that puts them to work on a picture’s rows: how much faster, and why not twelve times. |
| Class 18 — Tuesday, October 27 | Thursday’s picture in ten minutes, then the bytes as they are: fwrite to stdout, fread from stdin, and a picture passed from one program to the next through a pipe. |
| Class 17 — Thursday, October 22 | A picture is one array of bytes, three per pixel: drawing by writing them, and the formula that finds a pixel. |
| Class 16 — Tuesday, October 20 | Quiz 6, and one flag that names a memory mistake: who owns a piece of memory, and what happens when nobody does, two do, or memory is used after its owner frees it. |
| Class 15 — Thursday, October 15 | A function that hands back an array of its own: malloc, free, and memory that belongs to no function. |
| Class 14 — Thursday, October 8 | Walking an array, and then a string, with a pointer and no brackets. |
| Class 13 — Tuesday, October 6 | Quiz 5, an array’s name as an address, walking an array with a pointer, and pointers in pairs. |
| Class 12 — Thursday, October 1 | A calculator and the swap that works. |
| Class 11 — Tuesday, September 29 | Midterm Part 1, then the answers. |
| Class 10 — Thursday, September 24 | The practice test, then A4 on the projector. |
| Class 9 — Tuesday, September 22 | Strings and the byte that says stop, then a three-file program built twice — the second time from an empty directory with this page closed. |
| Class 8 — Thursday, September 17 | Arrays: a hundred numbers under one name, and what C does when you ask for the hundred-and-first. |
| Class 7 — Tuesday, September 15 | make, and the one line in a Makefile that decides whether the program you just ran is the program you just wrote. |
| Class 6 — Thursday, September 10 | A function the compiler cannot find, though it is right there in the file. Then one program split across three files. |
| Class 5 — Tuesday, September 8 | One missing character that gcc does not mention, then the rest of the assignment at your own speed. |
| Class 4 — Thursday, September 3 | Predict-then-run on one character, then a loop ladder you climb at your own speed. |
| Class 3 — Tuesday, September 1 |
Two rounds of predict-then-run on integer arithmetic, then the first three lines of seconds.c.
|
No matching items