CS208 Introduction to Computer Systems Monday, 27 March 2023 (Via Zoom because Jeff had COVID) + Hi! - Welcome back - Jeff Ondich, call me Jeff, Olin 301A + Today - What's the course about? - Logistics - Using Visual Studio Code & mantis.mathcs.carleton.edu - C basics + Layers of abstraction [hey Jeff: keep this to 10 minutes please] - What's going on when I run a python program? - Some layers Python program (hello.py) print('Hello, world') * Python interpreter (python3) written as a C program python3 hello.py [requests various services from the operating system. open a file, read from the file, write to standard output, etc.] * Assembly language version of python3 Machine language version of python3 Data path ["computer architecture"] Digital logic components Transistors, other electrical components * [There's an "operating system" layer in there somewhere, too] - This course 1991-2019: "how can you make a device that computes?" or "how do you organize a large pile of very simple electronic components into a computing device?" (i.e. a "computer architecture" course) (Lots of time at the "data path" and "digital logic" levels) - This course 2019-present: what underlying computer system structures enable us to use a mid-level programming language (C), with typed local and global variables, dynamic memory allocation, function calls, etc.? (i.e. higher on the diagram, closer to your day-to-day experience as a programmer) (Lots of time at the C and assembly language levels) - Benefits of the new version of the course - Closer to the concerns of day-to-day programming life - Insight into computer security - Insight into performance issues - Like the old version, this stuff is super-cool - General goal: tell the story of what happens when you compile and run a C program - Persistent theme: how is computer memory structured and used? + Rough plan - The C programming language, including pointers - Data representation how are integers, real numbers, and characters stored in memory and on disk? - x86_64 assembly language - what is the assembly layer mental model? what operations are available? - how do C structures get implemented in assembly language? - debugging assembly code with gdb (the "GNU debugger") - reverse engineering compiled code - buffer overflow attacks - the process and threads models; how the OS supports multi-programming (and why it turns out to be painful) - networking via the sockets model + Logistics - Course website - Upper-right menu on course website - Info (general information about the course) - Resources - Samples (pay attention! study! ask questions!) - Office Hours - Jeff (my Carleton home page) - Moodle: homework submission and quizzes - Slack (#announcements, #questions, etc.) + Masks, illness, etc. - Who knows what will happen this term? - Zoom will be available if you're ill and you let me know - Use the "office hours" Zoom link - It won't be ideal, but I'll mostly try to stay on-camera - Please mask if you have a cold while attending class I will do the same + Getting started: Unix, VS Code, C - Resources for learning more Unix: "Resources" link on course page - Resources for learning C: "Resources" link on course page - Sample programs: "Samples" link on course page. ** I expect you to study and play with these samples. Ask questions! - Doing your work on mantis.mathcs.carleton.edu - VS Code, remote editing, and an integrated terminal - First assignment: a couple small C programs - Second, bigger assignment: implementing queues + Short break - Introduce yourself to somebody you don't know. Get each other's pronunciation right. Book/movie/hometown/whatever. + C - C experience unevenly distributed: if you're taking 208 before 251, you'll be happy when you take 251 - hello.c (comments, variables, printf) + Visual Studio Code + mantis.mathcs.carleton.edu - Demo & pointer to lab + More C - character_counter.c loops, conditionals, functions, comparison to Java types: char, int, float, double file I/O - strings.c + Slightly weird C, relevant for the first assignment - arrays2d.c + Next - More C, focus on pointers - Queue implementation assignment (lotsa pointers!) - Integer notations: binary (0b), octal (0), decimal, hexadecimal (0x) - Data representation: integers, characters, real numbers, strings + For your homework - character_counter.c as a template for depunctuate.c - arrays2d.c as a template for sorter.c