









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










● (^) “from a programmer's point of view” ●
● (^) processors, memory, OS, compilers, networks, ... ●
●
● (^) Data representation —implement logical and arithmetic functions by manipulating the bits that make up values. ● (^) Disassembling an object code file —reverse engineer a program to determine what it does. ● (^) Implementing a buffer overrun attack —modify the run-time behavior of a program to exploit a buffer overflow bug. ● (^) Performance optimization —transform source code to make it run faster. ● (^) Exceptional control flow —implement your own Unix shell. ● (^) Dynamic storage allocation —implement your own version of C's malloc and free functions.
●
●
●
●
#include <stdio.h> int main(void) { printf("hello, world\n”); return 0; } hello.c 2369 6e63 6c75 6465 203c 7374 6469 6f2e 683e 0a0a 696e 7420 6d61 696e 2876 6f 6429 207b 0a20 2070 7269 6e74 6628 2268 656c 6c6f 2c20 776f 726c 645c 6e22 293b 0a0a 2020 7265 7475 726e 2030 3b0a 7d0a hello.c in hexl-mode (emacs) 23 is ASCII code for '#' in hex (35 in decimal)
●
● (^) preprocessing—more later ● (^) compilation—translates hello.c into hello.s (assembly lang) ● (^) assembly—translates hello.s into hello.o (machine lang) ● (^) linking—links hello.o to standard C library to get hello ... call printf addl $16, %esp movl $0, %eax ... hello.s (x86 assembly language) unix> gcc -o hello hello.c
●
● (^) first word is built-in shell command or name of executable file
●
● (^) copies the data (i.e., the string) from main memory to cache ● (^) then copies the string to the display device (and to the screen) unix> ./hello hello, world unix> Unix shell
●
● (^) Does all of this copying slow the “real work” of the program? ●
DISK MEMORY siz e decreasing speed increasing cost REGISTERS
●
MAIN MEMORY CACHE
●
●
●
main memory ●
●
● (^) detecting and fixing bugs more efficiently ● (^) understanding and tuning program performance ●
● (^) better at figuring things out yourself ● (^) making effective use of available documentation
●