Central processing unit
중앙 처리 장치(中央處理裝置, 문화어: 중앙처리소자) 또는 CPU(영어: central processing unit)는 소프트웨어 명령의 실행이 이루어지는 컴퓨터의 부분, 혹은 그 기능을 내장한 칩을 말한다. 컴퓨터 안의 중앙 처리 장치(CPU)는 외부에서 정보를 입력 받고, 기억하고, 컴퓨터 프로그램의 명령어를 해석하여 연산하고, 외부로 출력하는 역할을 한다. 따라서 중앙 처리 장치(CPU) 는 컴퓨터 부품과 정보를 교환하면서 컴퓨터 시스템 전체를 제어하는 장치로, 모든 컴퓨터의 작동과정이 중앙 처리 장치(CPU)의 제어를 받기 때문에 컴퓨터의 두뇌에 해당한다고 할 수 있다. 실제의 CPU 칩엔 실행 부분뿐만 아니라 캐시 등의 부가 장치가 통합된 경우가 많다.
Category
- CPU:Register
- CPUID
- Reduced Instruction Set Computer (RISC)
- Complex Instruction Set Computer (CISC)
- Load (Load Average)
- Hyper-threading
- CPU cache
- Execution
- 명령어 파이프라인 (Instruction pipeline) (Bubble, Operand forwarding)
- 비순차적 명령어 처리 (Out-of-order execution) (Register renaming)
- Speculative execution (Branch predictor, Memory dependence prediction)
- Data hazards
- Read after write (RAW)
- Write after read (WAR)
- Write after write (WAW)
- Structural hazards
- Control hazards (Branch hazards; Pipeline hazards)
Cache memory
캐시 메모리(cache memory)란, 속도가 빠른 장치와 느린 장치 사이에서 속도 차에 따른 병목 현상을 줄이기 위한 범용 메모리를 말하는 것이다. CPU 이외의 장치에서도 많이 사용되는 용어인데, CPU에서는 CPU 코어(고속)와 메모리(CPU에 비해 저속) 사이에서 속도 차에 따른 병목 현상을 완화하는 역할을 한다.
L1 캐시는 일반적으로 CPU 칩 안에 내장되어 데이터 사용/참조에 가장 먼저 사용된다. L1 캐시는 보통 8~64KB 정도의 용량으로 CPU가 가장 빠르게 접근하게 되며, 여기서 데이터를 찾지 못하면, 이제 L2 캐시 메모리로 넘어간다.
L2 캐시 메모리는 용도와 역할은 L1 캐시와 비슷하지만 속도는 그보다 느리다. 일반적으로 64Kb~4MB 정도가 사용된다. CPU 제품마다 약간 다르겠지만, 일반적으로 L2 캐시는 CPU 다이(회로판)에 별도의 칩으로 내장된다. 앞서 말한 대로 L1 캐시를 먼저 뒤지고, 없으면 L2 캐시를 뒤져 데이터를 찾는다. 역시 L2 캐시는 L1 캐시보다 느리지만, 일반 메모리(RAM)보다는 빠르다.
L3 캐시 메모리도 동일한 원리로 작동한다. 다만 요즘 웬만한 프로세서에서는 L3 캐시 메모리를 달고 있지 않다. L2 캐시로 충분히 커버할 수 있기 때문이다. 예를 들어, 인텔 코어2 듀오나 쿼드에는 L3 캐시가 없지만, 코어 i7에는 8MB를 달아뒀다. 물론 없는 것보다야 있는 게 분명히 낫겠지만, L1/L2 캐시 메모리 정도만 CPU 성능에 직접적인 영향을 미치기에 L3 캐시는 크게 신경 쓰지 않는 것이 일반적인 추세다. 참고로 이 L3 캐시는 CPU가 아닌 메인보드에 내장되는 경우가 더 많다.
CPU INFO in the Linux
리눅스에서 CPU정보를 확인할 수 있는 방법은 아래와 같다.
$ cat /proc/cpuinfo
$ lscpu
$ hardinfo
$ sudo lshw -class processor
$ nproc
$ sudo dmidecode -t 4
$ cpuid ## apt-get install cpuid
$ inxi -C ## apt-get install inxi
CPU 온도 확인
lm-sensors 항목 참조.
talkingaboutme.tistory.com Architecture
시간순서의 Study 및 Architecture 목록.
- 01 - [Study] Pipeline
- 02 - [Study] Pipeline Hazard
- 03 - [Study] Memory Hierarchy (1)
- 04 - [Study] Memory Hierarchy (2) - Direct Mapped Cache
- 05 - [Study] Memory Hierarchy (3) - Cache Write Policy
- 06 - [Study] Memory Hierarchy (4) - Sequence of Cache Write
- 07 - [Study] Dynamic Branch Prediction
- 08 - [Study] Single Cycle Implementation - Arithmetic Instruction
- 09 - [Study] Single Cycle Implementation - Memory Access Instruction
- 10 - [Study] Multi Cycle Implementation
- 11 - [Study] Pipelined Implementation Example
- 12 - [Computer Architecture] What is ILP?
- 13 - [Computer Architecture] Memory Technology
- 14 - [Computer Architecture] Motivation for Caches
- 15 - [Computer Architecture] Classifying Caches
- 16 - [Computer Architecture] SuperScalar Processor
- 17 - [Distributed System] lock
- 18 - [Distributed System] TestAndSet Lock
- 19 - [Architecture] Memory Hierarachy
- 20 - [Architecture] Basic of Virtual Memory (1)
- 21 - [Architecture] Basics of Virtual Memory (2)
- 22 - [Architecture] Page faults
- 23 - [Architecture] Building the MMU (1)
- 24 - [Architecture] Building the MMU (2)
- 25 - [Architecture] Contexts
- 26 - [Architecture] MMU improvements
- 27 - [Architecture] Processes
- 28 - [ARM] Registers on the ARM Cortex M4
45분만에 보는 현대 CPU 아키텍쳐 정리
인텔에서 현대 CPU 아키텍쳐의 각종 요소와 개념에 대해 간략히 짚어주는 2부작 영상을 유튜브에 올렸습니다. (영어) 2부를 모두 합쳐 대략 45분 정도의 분량으로, 컴퓨터공학과 대학생이 듣는 전공 강의의 오리엔테이션 수준이 아닐까 합니다.
1부
1부에서는 다음과 같은 내용을 다룹니다.
- CPU란 무엇인가?
- 간략한 CPU의 역사(인텔 중심으로)
- 컴퓨터의 추상화 계층
- ISA(명령어 집합 아키텍쳐)의 개념
2부
2부에서는 다음과 같은 내용을 다룹니다. ISA의 구현체인 마이크로아키텍쳐에 관한 내용으로, 1부보다 조금 더 심화된 내용이 나옵니다.
- 마이크로아키텍쳐의 개념
- [인출 ▶ 해독 ▶ 실행 ▶ 기록]의 4단계 명령 주기와 CPU에서의 프론트엔드/백엔드 구분
- 파이프라인 및 CPU 클럭 속도
- 분기 예측에 의한 추측 실행
- 메모리와의 속도 차이를 줄이기 위한 캐시
- CPU 내부에서 사용하는 μops(Micro-operations)의 개념
- 슈퍼스칼라(Superscalar)에 의한 ILP(명령어 수준 병렬성) 구현
- 비순차적 실행(Out-of-Order Execution)과 그 구현을 위한 여러 구성요소
- 이 모든 요소들의 결합에 의한 현대 CPU의 작동 과정
CPU technology
Architecture | Von Neumann, Harvard (Modified Harvard), Dataflow, TTA |
Instruction set | ASIP, CISC, RISC, EDGE, EPIC, MISC, OISC, VLIW, NISC, ZISC, TRIPS, Comparison |
Word size | 1-bit, 4-bit, 8-bit, 9-bit, 10-bit, 12-bit, 15-bit, 16-bit, 18-bit, 22-bit, 24-bit, 25-bit, 26-bit, 27-bit, 31-bit, 32-bit, 33-bit, 34-bit, 36-bit, 39-bit, 40-bit, 48-bit, 50-bit, 60-bit, 64-bit, 128-bit, 256-bit, 512-bit, variable |
Execution | Instruction pipelining (Bubble * Operand forwarding), Out-of-order execution (Register renaming), Speculative execution (Branch predictor * Memory dependence prediction), Hazards |
Parallel level | Bit (Bit-serial * Word), Instruction (Scalar * Superscalar), Task (Thread * Process), Data (Vector), Memory |
Multithreading | Temporal, Simultaneous, Preemptive, Cooperative |
Flynn's taxonomy | SISD, SIMD, MISD, MIMD (SPMD), Addressing mode |
Types | Digital signal processor (DSP), GPGPU, Microcontroller (MCU), Physics processing unit, System on a chip (SoC), Cellular |
Components | Address generation unit (AGU), Arithmetic logic unit (ALU), Barrel shifter, Floating-point unit (FPU), Back-side bus (Multiplexer * Demultiplexer), Registers, Memory management unit (MMU), Translation lookaside buffer (TLB), Cache, Register file, Microcode, Control unit, Clock rate |
Power management | APM, ACPI, Dynamic frequency scaling, Dynamic voltage scaling, Clock gating |
CPU hardware security | NX bit, Hardware restriction (firmware), Trusted Execution Technology, Secure cryptoprocessor, Hardware security module, Hengzhi chip |