목록Computer Science/System Programming (10)
엔지니어가 되고 싶은 공돌이

10. 1. Linker - Linking: 여러 개의 object file을 모아서, 하나의 execution file로 변환하는 과정. - Linker: Linking을 수행하는 Program. - Why Use a Linker? 1) Linking이 필요한 이유는 오늘날 소프트웨어 개발은 하나의 커다란 파일 또는 모듈에서 이루어지는 것이 아닌 여러 개의 작은 파일 또는 모듈에서 개발되기 때문에 이를 통합할 수 있는 과정이 필요합니다. 2) 작은 모듈로 나누어져 있기 때문에 모듈 하나를 수정해도, 다른 모듈들을 재컴파일 할 필요 없이 수정된 모듈만 컴파일하면 되므로, 효율성(Efficiency in Time and Space)이 좋아집니다. - What does a Linker do? 1) 여러 ..

9. 1. Array - Array Allocation: Data Type Array_Name[Length]; - Array를 Allocation 하게되면 연속적으로 저장하게 됩니다. ex) char val[5] => Memory Address: x, x+1, x+2, x+3, x+4. int val2[4] => Memory Address: x, x+4, x+8, x+12. - Array Access: %edx에 Array의 Start Address가 있고, %eax에 Array의 Index가 있다고 가정하면, Movl (%edx, %eax, 4), %eax 로 Array Value를 가져올 수 있습니다. [int Type Array] ex) int arr[5] = {1, 3..

8. 1. Stack - Process에서 Data는 Stack에서 관리합니다. - pushl: %esp 레지스터에서 4(64bit 컴퓨터는 %rsp 레지스터에서 8)를 감소시키고, 스택에 지정한 레지스터의 값을 넣습니다. - popl: 스택의 값을 레지스터에 넣고, %esp 레지스터에서 4(64bit 컴퓨터는 %rsp 레지스터에서 8)를 증가시킵니다. 8. 2. Procedures - Procedure Call(call label): stack에 return address(현재 PC 값)를 push하고, Label로 Jump합니다. - Procedure Return(ret): stack에서 return address를 pop하고, retrurn adderss로 Jump합니다. - Call..

7. 1. Flag Bit Register - Flag Bit Register는 Arithmetic Operations로 Implicit하게 설정되고, Compare Operations로 Explicit하게 설정됩니다. - t = a + b. CF: Carry O -> 1, ZF: t == 0 -> 1, SF: t 1, OF: (a > 0 && b > 0 && t 0) -> 1. - cmpl b, a ( a == b ) : a – b , 이 연산의 결과값은 저장되지 않으며, 오직 Flag Bit 세팅에만 사용됩니다. - testl b, a : a & b , CF와 OF는 0으로 두고, 나머지 2개에만 관심을 갖습니다. 7. 2. Jumping - jX instructions:..

6. 1. Assembly Instruction - Moving Data Instruction: movl(source, destination) - Operand Types: Constant Integer Data / Register(주로 변수) / Memory(주로 포인터) Mem와 Mem사이의 데이터 교환은 one clock에 two instruction이기 때문에 불가능합니다. - ex) movl 12(%ebp), %ecx : %ebp +12 -> %ecx. movl (%edx, %ecx), %ebx : %edx + %ecx -> %ebx. movl (%edx, %ecx, 4), %ebx : %edx + %ecx X 4 -> %ebx. - ( )는 레지스터 내부..

5. 1. Program - Program: Data와 Instructions의 집합. - CPU(Central Processing Unit) 1) PC(Program Counter): 다음 실행할 명령어의 주소를 저장. IA-32: EIP , x86-64: RIP. 2) Register File: 많은 Program Data를 저장. 3) Condition Codes: 최근에 수행한 산술연산의 Status Information을 저장. - ISA(Instruction Set Architecture): 명령어 집합으로, 명령어를 구성하는 필드의 수, 필드당 비트를 지정. ISA는 software와 hardware 사이에서 interface역할을 수행하며, ISA에 따라서 명..

4. 1. 32bit vs 64bit - 컴퓨터에서 기본 데이터 처리 단위를 word라 부릅니다. 과거에는 32bit 컴퓨터를 썼기에 word size는 32bit 였지만, 오늘날 컴퓨터는 대부분 64bit 컴퓨터를 쓰기에, 오늘날 word size는 64bit 입니다. - Virtual Memory도 32bit 컴퓨터에서는 4GB이지만, 64bit 컴퓨터에서는 16TB로 확장됩니다. 이론적 크기는 264 = 16EB이지만 실제로는 이것보다 더 작은 크기를 사용합니다. - Memory는 접근의 편의성을 위해 Address를 가지고 있습니다. 32bit 컴퓨터는 4Byte 이므로 연속되는 word의 Address는 4씩 차이가 나고, 64bit 컴퓨터는 8Byte 이므로 연속되는 ..

3. 1. Fixed Point Number - sign, integer, fractional 3개의 part로 나누어서 수를 저장합니다. - sign bit가 0이면 양수를, 1이면 음수를 표현하고, integer part로 소수점 앞부분의 수를 2진수로 표현하며, fractional part로 소수점 뒷부분의 수를 2진수로 표현합니다. ex) sign 1 bit / interger 3 bit / fractional 4 bit 라고 가정하면, 5.625 -> 0 101 1010 로 표현합니다. - Pros: 간단하고, Floating Point Hardware가 필요없고, Low cost Embedded Processors에서 사용. - Cons: Cannot represent wi..

2. 1. Integer 1) Signed Integer - Encoding Positive Number is the same as unsigned numbers. - Encoding Negative Number is 2’s complement. 2) Numeric Ranges - Unsigned Values: MIN = 0 [00 … 00], MAX = 2n – 1 [11 … 11]. - Signed Values: MIN = - 2n - 1 [100 … 00], MAX = 2n - 1 - 1 [011 … 11]. 3) Sign Extension - Fill with sign bits. - if A + B bits -> A bits Truncate it to lower A bits. 4) Uns..

1. 1. Digital Systems - 컴퓨터에서는 Binary Number(0, 1)를 사용합니다. - Easy to store with bistable elements and Reliably transmitted on noisy. - Boolean Algebra is a mathematical foundation for modern digital systems. - Computer: 입출력이 있으며, 방대한 정보를 저장, 검색, 처리하며, 다른 기계장치들을 제어하는 프로그래밍이 가능한 전자기기. - Function: 특정한 목적의 작업을 수행하기 위해 설계된 코드의 집합. - Algorithm: 문제해결방법을 정의한 일련의 단계적 절차.