1. getting started
due Tue Sep 4
- Read chapter 1 in the text, "A tour of computer systems"
- Start reading chapter 2.
- Browse the links on the resources page.
- Browse Norm Matloff's unix and C tutorials (if you need them)
- Get your tools ready: gcc, an editor, access to the unix command shell, and remote access to our server shannon.marlboro.college.
Writing (submit this through the website, showing what you did.)
- Compile, write, and run the classic "hello world" program in C, as described in the text and at wikipedia: Hello_world_program. You can do this on our remote server, shannon.marlboro.college or on your own machine. Be clear about what you did, how you compiled and ran it, and what ersions of what software you used.
- Write a C program to solve project euler's problem 9 : find a pythagorean triple whose sum is 1000.
- Tell me how all of the stuff above hit you: review? way over the top? somewhere between?
2. chap 2 and C practice
due Tue Sep 11
- Finish reading through chapter 2, at least the topics we discussed. (The CMU lecture slides may also be helpful.)
- Study the C programs that I showed in class on Thursday.
- Write at least one of these in C:
- Something similar to the the word_list example I showed in class which stores instead a list of (x,y) points in a linked list. It should read the list of points (from user input or a file) and then print it out in reverse order. It should also be made of multiple files (a library and a something that calls it) which compile to one executable, and use struct, malloc, and pointers to allocate the (x,y) points as structs on the heap, along with a pointer to the next in the list.
- Or a program which outputs cyclic variations of a given list. For example if the list is [1,2,3,4], the output would be [1,2,3,4], [2,3,4,1], [3,4,1,2], ...
- Do the following exercises from the text.
- practice problem 2.11 (swap using bit operations) . Explain what's going on.
- practice problem 2.14 (bit and logical operations)
- practice problem 2.23 (byte extraction idioms)
- homework problem 2.60 : implement the "unsigned replace_byte(unsigned x, int i, unsigned char b) function.
- homework problem 2.61 & 2.64 : bit tests without "if" . (And/or do several ways.)
- homework problem 2.76 : implement a robust calloc
- practice problem 2.47 (if we don't do it in class), 5-bit float
- Let me know how easy or hard this material is - should we spend more time on it?
3. starting machine code
due Tue Sep 18
- Start reading chapter 3 in the text, "Machine Code", at least through 3.4.
- Also check out the 2015 cmu slides "Machine Prog" which summarizes that stuff.
- Also start looking through the x86, gdb, and assembler links (including my old notes) on the resources page.
- Use gdb and objdump to work through some of the examples in the text and/or in my old notes.
- Work through any of the practice problems 3.1 through 3.5 - solutions are in the text.
- Post a summary of your explorations and come to class on Tuesday ready to show, tell, and discuss.
4. continue machine code
due Tue Sep 25
- Read in the text or other sources the material covered in the "Machine Programming: basics, control, procedures, data" slides.
- Practice working through short C programs using objdump and gdb or similar tools - your choice as to what.
- Report on your progress.
5. Bomb Lab !
due Thu Oct 4
Do the CMU bomb lab. The "README" and "Self Study Handout" describe what's to be done.
# On shannon
$ wget http://csapp.cs.cmu.edu/3e/bomb.tar
$ tar xf bomb.tar
$ cd bomb
Welcome to my fiendish little bomb. You have 6 phases with
which to blow yourself up. Have a nice day!
... you type here ...
The bomb has blown up.
- Submit your solution and an explanation of what you did, including references, sources, sample sessions - whatever you think is needed for another student to understand your work.
- For full credit, do this on your own. If you get stuck or need a hint, you may ask me or another student ... but if so you must say so and explicitly cite that as a reference.
- Come to class ready to discuss.
- This one is for a grade based on technical merit and clarity of explanation.
- Submissions past this date will be accepted but for reduced credit since we'll be discussing it in class.
6. stack attacks
due Thu Oct 11
- Read 3.10 in the textbook.
- Do practice problems 3.46 and 3.48
- Read the "Attack Lab Writeup" from the cmu lab assignments and describe in your own words what you would need to do. (I'm not asking you to do the lab - just to explain what it's all about.
7. optimization & memory
due Tue Oct 23
- Read chapters 5 (optimization) and 6 (memory).
- Choose at least one practice problem from each chapter to write-up and share in class : one on Thu Oct 17, one on Tue Oct 23.
- Write a C program that does a numerical computation on collections of numbers. Some reasonable choices include
- Multiply two N x N matrices. (See the cache-meories slide for some ideas).
- Find the determinant of an N x N matrix.
- Find the mean and standard deviation of a list of numbers.
- Measure its run time and explore ways to make it run faster as described in the text and discuss. For example,
- compiler optimization flags (i.e. -O1 or -O2 or ...)
- explicitly unrolling loops by doing chunks of the calculation at a time
- breaking the problem into smaller functions
- use gprof to look for bottlenecks (probably after breaking the task into smaller functions)
- "localizing" the data access