COMP SCI 354
Machine Organization & Programming
University of Wisconsin - Madison
University of Wisconsin - Madison
An introduction to fundamental structures of computer systems and the C programming language with a focus on the low-level interrelationships and impacts on performance. Topics include the virtual address space and virtual memory, the heap and dynamic memory management, the memory hierarchy and caching, assembly language and the stack, communication and interrupts/signals, compiling and assemblers/linkers.
The homework consisted of weekly activities and programming assignments.
The weekly activities are similar to CS240 or CS300's Canvas quizzes. There are usually 5-7 problems that test your knowledge on the previous week and this current week's material. The questions are not too difficult. However, tracing assembly code, analyzing C syntax, or debugging problems are more involved.
The programming assignments are not difficult either. They are similar to assignments in entry-level programming courses. Since CS 354 introduces students to low-level programming, I believe this is a good way to smoothen the learning curve of C programming & x86-64 assembly language programming. In my semester, we had 6 programming assignments:
P1: Introduction to C - parsing through 100+ text data
P2: Arrays - 1D & 2D arrays with pointers
P3: Linked lists - structs
P4: Memory Allocator - building a memory allocator that mimics the effect of malloc and free
P5: Introduction to x86-64 assembly language - implement toUpper() with assembly language
P6: Cache memory - stimulating a read-only L1 cache
The exams were conducted in-person. The problems were similar to those from CS200 & CS300. We were expected to know C & x86-64 syntax, be able to trace through code, and identify the better solution to a problem.
The midterm had a weight of 15%, and the final exam had a weight of 20%. The final exam is cumulative. However, Professor Mike gave us a list of topics that could be on the final exam, which greatly narrowed down what to review. Moreover, we were given a reference sheet of the common registers to assist us in parsing assembly code.
Neither of the exams were overly difficult. There are some questions that are tricky. However, the exams were mainly focused on the topics that were covered right before the exam. For the midterm, the main topic was the memory allocator and how malloc/free works in the heap. For the final exam, the main topic was assembly code & cache memories.
With CS354 being the gateway to declaring a CS major, it is no surprise that it is a class that "weeds" out students. The class definitely takes a different path, compared to classes such as CS200/300/400. The programming languages for this class are also low-level programming classes. It is a big jump to go from programming in Java & Python to programming in C. There is a steep learning curve for C programming, especially since Professor Mike demonstrated & encouraged us to use VIM to write the C programs. Personally, I preferred to use VSCode to program C due to auto-formatting, syntax highlighting, etc. However, it was rather lengthy to set up and frustrating to figure out how to link multiple C files to each other (GitHub Q&A link below).
There are a lot of AMAZING resources online for C programming, especially since it is SUCH an old language. Here are the ones that I thought were most helpful for everything, from VSCode set up to x86-64 memory addressing.
C or VSCode overview: https://code.visualstudio.com/docs/languages/cpp
C syntax highlighting in VSCode: https://stackoverflow.com/questions/64006618/how-to-enable-c-syntax-highlighting-in-vscode
Link multiple C files: https://github.com/microsoft/vscode-cpptools/issues/5502
Pointers & memory: http://cslibrary.stanford.edu/102/PointersAndMemory.pdf
Memory management in C: https://www.tutorialspoint.com/cprogramming/c_memory_management.htm
x86-64 cheat sheet from Brown University: https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf
x86-64 common commands & addressing: https://www.cs.cmu.edu/afs/cs/academic/class/15213-s20/www/recitations/x86-cheat-sheet.pdf
x86-64 memory addressing: https://blog.yossarian.net/2020/06/13/How-x86_64-addresses-memory