Computer Arithmetic
Ints are not Integers, Floats are not Reals.
이게 무슨 말일까?
ex1) x^2>=0?
float: true(오버플로우 발생한다고 음수, 양수가 뒤집히진 않음.)
int: false(오버플로우 발생하면 음수가 됨.)
ex2) (x+y)+z = x+(y+z)?
int: true
float: 정확도 문제로 인해 값이 달라질 수 있음.
bit 연산
*1의 보수: clock을 한번 invert시켜서 bit연산 단위로 값을 뒤집음.
-> 음수 0/양수 0이 나오는 문제
*2의 보수
1의 보수 연산 + 1(overflow는 버림)
->1의 보수에서 발생하는 문제 해결
컴퓨터에서 더하기 연산을 통해 빼기 연산 또한 가능해짐.
Understanding assembly is key to machine-level execution model.
Memory Matters
*Memory is not unbounded.
*Memory referencing bugs especially pernicious.
*Memory performance is not uniform.
ex)메모리 참조 에러에 대한 example
특히 C/C++에서 치명적임.
*Out of bounds array references
*Invalid pointer values
*Abuses of malloc/free
#4. There's more to performance than asymptotic complexity
#5. Computers do more than execute programs
Computer
-HW: CPU, I/O devices,
-SW:
Hardware organizatin of a typical system