Computer
Systems

Fall 2018
course
site

Tue Oct 22

First: finish discussion of optimization & memory - classroom presentations.

Second: finish discussion of linking. We won't spend too much time on this, but I will have part of next week's assignment to try some of this ... so do read chapter 7, but don't spend too much time on it.

Third: start discussion of "ECF" - "Exceptional Control Flow", chapter 8 in text, using the CMU lecture notes. This includes interrupts, signals, process swapping and how that happens ... important stuff. The "shell lab" goes along with this material, which is one of your choices for a final project. So read chapter 8 carefully.

Coming after that: following the CMU notes, after we'll do chapter 10 : unix input/output, i.e. files & sockets. We're going to skim that material briefly, as they do. You are likely already somewhat familiar with this material from other coding experience. Do read chapter 10 but don't get bogged down in the details.


I'll post the next assignment by Thursday on some of this stuff, depending on how far we get.

cmu code

Note that as we progress, you will want to use their C code libraries as examples and templates ... this will be particularly true for the I/O and process stuff, where they have wrappers that are safer and more robust than the standard C calls.

See the "cmu code" link to the left (if you haven't found their stuff already), and check out particularly

and the examples in the link, io, and ecf folders (the chapters listed above).

To compile and run for example cpfile.c on shannon, first copy src/csapp.c, include/csapp.ch, and io/cpfile.c into the same folder. Also create a test.txt file with whatever you like. Then

$ gcc -O2 -pthread csapp.c cpfile.c -o cpfile
$ ./cpfile < test.txt

... will echo the file to stdout.

(pthread is "posix thread", which csapp.c references and therefore requires. There's a non-obvious difference between -lpthread i.e. "include thread library" and -pthread i.e. "include library and some macro definitions" ; google for example "pthread vs lpthread" for the gory details.)

https://cs.marlboro.college /cours /fall2018 /systems /notes /linking
last modified Sun October 17 2021 12:24 pm