반응형

전체 글 114

Lecture 1.1 ~ 1.2: Introduction, Protocols and Layering

1-1 Goals and Motivation Copyright © Pearson Education, Inc. or its affiliate(s). All Rights Reserved. mediaplayer.pearsoncmg.com Three "networking" topics - Distributed systems : 각기 다른 어플리케이션들이 어떻게 네트워크 상에서 - Networking : 패킷들이 어떻게 네트워크 상에서 - Communications : 신호를 통해 어떻게 메세지가 네트워크 상에서 우리가 배울 것은 Networking! The Main Point 1. To learn how the Internet works 2. To learn the fundamentals of computer ..

Lecture 09: Machine-Level Programming 5: Advanced Topics

Memory Layout x86-64 Linux Memory Layout 최대 주소 값이 00007FFFF....FF 인 이유는 x86-64에서는 47 비트를 주소에 사용하기 때문 메모리 할당은 주소의 낮은쪽이나 높은쪽에서부터 된다 Memory Allocation Example malloc으로 할당한 메모리 중에 큰 메모리는 주소값이 큰 쪽에 할당되고, 작은 메모리는 주소값이 작은 쪽에 할당됨 계속 할당하다보면 사이에 존재하는 공간이 없어진다 Buffer Overflow : Vulnerability, Protection Recall: Memory Referencing Bug Example Such problems are a BIG deal String Library Code Vulnerable Buffe..

Lecture 08: Machine-Level Programming 4: Data

Arrays Array Allocation Array Access char *p; p++; // 실제로 p = p + 1; int *ip; ip++; // c언어에서는 +1이지만 실제로 ip = ip + 4; *(ip + 2) // 아래와 같다 ip[2] ip + x // notation ip + 4x // computation &는 주소값을 반환 *( 포인터 주소 )는 해당 주소에 저장된 값을 반환 Q. *(ip + negative_value) 가능한가? A. 컴파일러는 아무 상관없이 작동할 것이다. 다만 undefined value가 찾아질 뿐.. Q. *(2 + ip) 라면 어떻게 되는가? A. 불가능할 것이다 ㅎㅎ *(ip + 2)가 가능했던 것은 컴파일러가 포인터라는 것을 알고 +2를 scale..

Lecture 07: Machine-Level Programming 3: Procedures

Mechanisms in Procedures Passing Control : 빨간색 화살표와 같이 호출되면 이동했다가 리턴되면 다시 돌아가는 Passing data : P에서 정의된 x 값이 Q에 i로 전달되고, 리턴되는 값이 다시 P로 반환되는 Memory management : C에서는 반환되면 deallocate x86-64에서는 오버헤드를 많이 줄였다 Procedures x86-64 Stack LIFO : Last In First Out x86-64 Stack: Push x86-64 Stack: Pop Coding Conventions Procedure Control Flow %rip : program counter callq instruction은 아래의 3가지 역할을 한다 decrement s..

Lecture 06: Machine-Level Programming 2: Control

Control: Condition codes Processor State (x86-64, Partial) x86-64에는 16개의 register가 존재 rsp는 stack을 나타내는 레지스터 rip는 명령문을 가리키는 레지스터 condition codes는 주어진 4개의 1 bit flag 말고도 8개가 존재 Condition Codes (Implicit Setting) CF : 너무 큰 수의 연산에서 MSB 비트에서 올림이 발생한 경우 ZF : 연산으로 인해 0의 값이 발생한 경우 SF : 두 수의 연산으로 인해 음수의 값이 발생한 경우 OF : 연산에서 overflow가 발생한 경우(positive overflow & negative overflow) Condition Codes (Explicit ..

LeetCode - median of two sorted arrays

Median of Two Sorted Arrays - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 나의 풀이 - 실패 떠올린 방식 1. 하나의 배열에 모두 넣고 binary search - time complexity : O(n log n) - 문제의 시간 복잡도 제한 조건을 만족하지 못하는 풀이 2. lowerBound를 이용해서 해당 수보다 작거나 같은 수를 찾아서 각각 확인하는 방식 - time complexity : O(log (n + m)) - 배열의..

반응형