본문 바로가기

전체 글21

Memory Consistency Model Memory Consistency Model 의 필요성 아래에서 2개의 Thread로 코드들을 실행시키는 예를 보자. - initial int A, flag = 0; - Thread 1 A = 1; flag = 1; - Thread 2 while (flag == 0); print(A); 이때 컴파일러는 소스코드의 program order를 제대로 컴파일 되었다 해도, 오른쪽에서 A 는 0을 출력할 수도 있다. 프로세서의 OOO Execution으로 인한 메모리 access 순서가 바뀌었을 수도 있고, 아니면 하필 Thread 1 Cache에서 flag에 대한 write만 먼저 메인메모리에 먼저 반영되었을 수도 있다. * 참고로 동일한 프로세서의 동일한 address에 대한 write는 그 순서가 항상 보.. 2023. 10. 24.
Cache coherency protocols * 이글의 내용 및 그림들의 많은 부분을 아래 자료들로 부터 참고해 왔습니다. - Computer Architecture: A Quantitative Approach ( 6th edition ) - Prof. Dr. Ben H. Juurlink youtube ( https://www.youtube.com/@prof.dr.benh.juurlink5459/videos ) Introduction to Multiprocessor System Memory Architectures 여러프로세서와 캐시 및 메모리를 구성하는 방법은 크게 Centralized Shared-Memory Architectures, Distributed Shared-Memory ( DSM ) 로 나눌 수 있다. Centralized Shar.. 2023. 10. 24.
Instruction-Level Parallelism : Hardware Based Speculation for Out-of-Order Execution * 이글의 내용 및 그림들의 많은 부분을 아래 자료들로 부터 참고해 왔습니다. - Computer Architecture: A Quantitative Approach ( 6th edition ) - Prof. Dr. Ben H. Juurlink youtube ( https://www.youtube.com/@prof.dr.benh.juurlink5459/videos ) * 이글은 프로세서의 Out-of-Order Execution 에 대한 심화내용이니, 해당 내용을 모른다면 이전글 Instruction-Level Parallelism : Out-Of-Order Execution( https://zbvs.tistory.com/36 )을 참고하세요. Key Ideas for H/W Based Out-of-Or.. 2023. 10. 24.
Instruction-Level Parallelism : Out-Of-Order Execution * 이글의 내용 및 그림들의 많은 부분을 아래 자료들로 부터 참고해 왔습니다. - Computer Architecture: A Quantitative Approach ( 6th edition ) - Prof. Dr. Ben H. Juurlink youtube ( https://www.youtube.com/@prof.dr.benh.juurlink5459/videos ) Instruction-Level Parallelism: Concepts and Challenges What is Instruction Level Parallelism? 아래 loop를 봐보자. 비록 x[i] = x[i] + y[i]; 부분에서는 병렬적으로 실행할 부분이 적지만, 각 Iteration 1회는 서로 의존적이지 않으므로 병렬적으로.. 2023. 10. 24.
Kafka: Exactly-Once Semantics ( * Kafka Definitive Guide - Chapter 8. Exactly-Once Semantics 내용에 기타 Reference 자료를 추가해 정리해놓은 글입니다. ) Idempotent Producer 어떤 연산이 있을 때 몇번을 재 실행해도 그 결과 State가 동일하다면 Idempotent 하다고 한다. ex-1) UPDATE t SET x=18 where y=5 는 Idempotent 하다. ex-2) UPDATE t SET x=x+1 where y=5 는 Idempotent 하지 않다. Producing 과정에서 Duplicated Producing은 Leader가 Message를 받고 성공적으로 Replication을 수행한 후 Producer에게 성공 메시지를 보내는 찰나에 L.. 2022. 2. 12.
Hypervisor ( x64 ) # CPU/MMU Memory Mapping Memory Mapping http://haifux.org/lectures/312/High-Level%20Introduction%20to%20the%20Low-Level%20of%20Virtualization.pdf x64라도 access 하려는 virtual address의 [63:48] 비트는 쓰이지 않는다. CR3 레지스터는 PM L4 (PageMap Level4) 물리 주소를 가리키고 access 하려는 virtual address의 [47:39] 비트는 PM L4에 Offset값으로 쓰인다. PML4 엔트리의 구조는 다음과 같다. PML4 Entry의 [51:12] 비트는 다음 레벨( PDPT ) 테이블의 물리 주소를 가리킨다. 같은방식으로 반복해서 .. 2022. 1. 16.
Garbage Collection 알고리즘 - 2 참고자료 https://www.amazon.com/Garbage-Collection-Handbook-Management-Algorithms/dp/1420082795 http://www.cs.technion.ac.il/~erez/courses/gc/ https://v8.dev/blog/concurrent-marking # Reference Counting https://www.cs.technion.ac.il/~erez/courses/gc/lectures/08-reference-counting.pdf ( 이 내용은 CPython 문서를 참고했다. https://devguide.python.org/garbage_collector/ ) Reference가 추가 될 때마다 ref count를 증가시키고, Refe.. 2021. 12. 31.
Garbage Collection 알고리즘 - 1 참고 자료 http://www.cs.technion.ac.il/~erez/courses/gc/ https://www.amazon.com/Garbage-Collection-Handbook-Management-Algorithms/dp/1420082795 # 마크-스윕 ( mark-sweep ) http://www.cs.technion.ac.il/~erez/courses/gc/lectures/01-Basics.pdf 우선 마크-스윕은 Reachable한 오브젝트를 마킹한다음 마킹이 안된 object를 Free시키는 방법이다. Free 상태인 메모리는 반드시 Free상태인 Chunk를 list로 관리한다( glibc malloc 의 메모리 관리 방법이랑 비슷하게 ). 중간 중간에 위치하는 사용가능한 메모리 청크.. 2021. 12. 31.
CPU Cache 사상과 회로 구성 참고 글 : https://www.clear.rice.edu/comp425/slides/L24.pdf 이 글은 다음과 같은 시스템을 가정하고 보자. * 메인 메모리 : 4GB ( 32bit 메모리 주소 ) * Cache size : 64KB ( 2^16 bytes ) * Block ( Line ) size : 64byte ( 2^6 bytes ) -> 따라서 메인 메모리의 총 블록 수는 : 2^32 / 2^6 = 2^26 -> 캐시의 총 블록 수는 : 26^16 / 2^6 = 2^10 Fully Associative Mapping ( 완전 연관 사상 ) 완전 연관 사상에서는 하나의 캐시 블록(Line)이 그 어떤 메인메모리 블록이라도 캐싱할 수 있다. 예를들어 하나의 캐시 블록은 26 bit의 Tag값을.. 2021. 12. 4.