컴퓨터 구조 - 1주차

Pyro·2022년 9월 6일
1

Computer-Architecture

목록 보기
2/2

ISA

  • Instruction Set Architecture
  • abstract interface between the hardware and the lowest-level architecture

일반적으로 Computer Architecture 라고 하면 곧 ISA 를 뜻한다고 한다.
컴퓨터 구조 과목에서는 ISA 가 어떻게 동작하고, 어떻게 사용할 수 있는지를 배우게 될 것 같다.

ISA 와 OS interface 를 합쳐서 ABI (Application Binary Interface) 라고 부른다.
API 처럼 일반적인 프로그래머가 호출하거나 사용할 수 있는 요소인지는 아직 감이 안 온다.

컴퓨터 구조의 아이디어

다음 7가지 아이디어가 핵심이라고 한다.

  1. Use Abstraction to Simplify Design
  2. Make the Common Case Fast
  3. Performance via Parallelism
  4. Performance via Pipelining
  5. Performance via Prediction
  6. Hierarchy of Memory
  7. Dependeability via Redundancy

7번째 아이디어에서, 안정성(dependability) 을 위해 여분의(redundant) 의 HW component 를 준비해둬어야 한다는 생각이 흥미롭다.
코딩 테스트를 포함한 일반적인 상황에서는 고려하지 못한 요소 같다.
DI 를 통한 싱글톤을 사용할 때에는 생각지 못할 것 같고,
인프라 관리에서 서버 운용을 할 때 유의미할 것 같다.

7가지 요소 모두 개발자로 프로그래밍을 하며 고려할만한 요소라고 생각한다.

5 Classic Compnents of a Computer

컴퓨터를 구성하는 5가지 요소를 뽑으면 보통 다음과 같다고 한다.

  1. Input Device
  2. Output Device
  3. Memory
  4. Datapath
    a. arithmetic operation 을 수행하기에, arithmetic & logical unit 이라고도 한다.
  5. Control
    a. I/O, memory, datapath 를 모두 관리하는 component 이다.

Datapath 와 Control 을 합쳐서 Processor 라고 부른다.

Memory 는 크게 main(primary) memory 와 secondary memory 로 나누어지는데,
main memory 에서는 실제로 실행할 프로그램들을 올려서 빠르게 처리하고,
secondary memory 에서는 프로그램 실행에 필요한 코드와 정보들을 저장한다.

cache memory 에는 SRAM(Static Random Access Memory)를 사용하며,
그렇지 않을 경우 DRAM(Dynamic Random Access Memory)를 사용한다.

Amdahl's Law

Execution time after improvement=Execution time affected by improvementAmount of improvement+Execution time unaffected\text{Execution time after improvement} = \frac{ \text{Execution time affected by improvement} }{ \text{Amount of improvement} } + \text{Execution time unaffected}

요약하자면 특정 부분의 성능을 아무리 개선하더라도,
영향을 받지 않은 부분이 언제나 병목이 된다는 이론이다.

병렬 프로그래밍 관점에서 정리하면 다음과 같다.

즉 아무리 더 많은 CPU 를 통해 작업을 병렬화 한다고 하더라도,
병렬화되지 않은 부분이 남아있다면, 속도를 개선하는데 한계가 발생한다.
(병렬로 처리되는 부분이 50% 이면 8코어 이상 부터는 별로 의미가 없어진다)

병렬처리가 가능하도록 프로그래밍하는 숙련도를 가진 사람이 많지 않다는 점을 고려하면,
프레임워크 차원에서 병렬로 실행되도록 지원을 더 많이 해주어야 의미가 있어질 것 같다.

성능 측정

CPI (Clock cycles Per Instruction)

CPI=Instructions for a program×Average Clock Cycles=Execution Time×Clock RateInstruction Count\text{CPI} = \text{Instructions for a program} \times \text{Average Clock Cycles} = \frac{\text{Execution Time} \times \text{Clock Rate}}{\text{Instruction Count}}

MIPS (Million Instructions Per Second)

MIPS=Instruction CountExecution Time×106=Clock RateCPI×106\text{MIPS} = \frac{\text{Instruction Count}}{\text{Execution Time} \times 10^6} = \frac{\text{Clock Rate}}{\text{CPI} \times 10^6}

MIPS 수치를 이용해 Architecture 의 성능을 가늠해볼 수 있다고 한다.

profile
dreams of chronic and sustained passion

0개의 댓글