User mode: commands that don’t affect hardware Kernel (supervisor mode): affect hardware MMU page fault → virtual address references a VP that is not caches in DRAM | system calls: program instructions that require kernal priveledges stdin, stdout: scanf(“%d”, &d) stored info in var d; in scanf %d assumes base 10 pos/neg w/ decimal, %i autodetects base to be hexidecimal, octal, or base 10; Int main(int argc, char** argv){}; %p to printf pointer type; must use -> operator to access struct fields when struct is a pointer variable; p->d = data stores int to d var within the p pointer struct # malloc = # frees; # malloc > # free → memory leak; # malloc < # free, unpredictable behavior; check if pointer is null, then set to null after free(pointer). Calloc == zero initialized; ASCII 7 bits, log2(#) = necessary # bits int* a = (int*)malloc(sizeof(int)); 2s complement range -(2^n-1) to (2^n-1)-1; signed is just - to pos (2^n-1) Converting to base two, recursively divide quotient by 2 and the remainder is the bit, flip at the end; MSB is 1st Vars: must start w/ a letter/underscore; names are letters, digits, underscores; max length of 31 char; no reserved words; case-sensitive If a global has the same name as a local, the program favors the local. Extern keyword allows one to reference a global variable locally so that the global var value will be passed; static → global scope 2s comp range -(2^n-1) to (2^n-1)-1, RAM: random access memory, computer’s short term, mantissa=significand, 127-> 01111111, relocation (linking) makes sure everything has a memory address, total size of .text=#instruct*4, static library = archive ~libc.a, ar program, sram (static) faster than dram (dynamic, main memory), bus has #of copper wired = WORD size = bit system (ie 32), only 1 component can write but all can read at a time, control unit is in CPU, registers and main memory are the most volatile, you lose them when you restart, 1k=1024 Overflow if 2’s comp: added 2 pos and got neg (or vice versa), unsigned: value is greater or less than max, Converting fraction: multiply by 2, then whatever is to the left of the decimal is the next bit (make sure you fill all the bits, default to 4bits.4bits), loader just loads into main memory