CS 214 / Intro ============== Systems Programming Prof. David Menendez Please put [CS214] in the subject line Please use the discussion tab in Canvas for course questions Office hours: Hill 448, schedule pending Recitations should start next week (Please look for an announcement) Systems programming: what is it? - Language run-time systems e.g., standard library features (file IO, memory allocation, etc.) - operating systems (OS) - shared implementation of common features - management of shared resources - protect programs from other programs - protect users from other users - maintain abstractions - common utilities and user interface C programming language Unix-style operating systems (Linux, MacOS, *BSD, etc.) - file IO - file systems - multitasking, process control - network communication (sockets) - multithreading (pthread) Project-oriented class three or four large programming assignments these are two-person assignments why? - most of you will need to work with others in the future - future classes will involve larger group projects - opportunity to work with others tips - be very clear about who you are working with - communicate - determine clear goals and responsibilities - don't wait until the last few days to see what the other person wrote Reference compiler GCC 13 Reference environment is the Instructional Lab (iLab) Why C? ------ C is a relatively simple language - gives good visibility to the hardware and OS features - designed to run (and be run) on low-powered hardware C vs Java - similar syntax - similar orientation Java is interpreted java source code -- javac --> "byte code" MyClass.java MyClass.class requires another program (java) to execute the byte code C is compiled C source code -- gcc -> executable myprogram.c myprogram C source code -- gcc -> unlinked machine code -- ld --> executable myprogram.c myprogram.o myprogram compiler translates source code to machine code source code - human-readable text machine code - binary format understood by the CPU Compiling programs with gcc gcc hello.c compile source file "hello.c", link with standard library, produce executable called "a.out" gcc hello.c -o hello gcc -o hello hello.c compile source file "hello.c", link with standard library, produce executable called "hello" gcc main.c support.c mymalloc.c -o prog compile 3 source files, link together along with standard library, produce executable called "prog" gcc -c hello.c gcc hello.c -c compile "hello.c", produce unlinked object file "hello.o" gcc main.o support.o mymalloc.o -o prog links 3 object files together with standard library, produce executable called "prog" recommended options -Wall enables the most useful warnings -std=c99 enforce usage of 1999 C standard -g inserts information for the debugger -fsanitize=address inserts AddressSanitizer into your executable