컴퓨터 구조 (1) Computer Organization & Performance

2022. 3. 10. 16:14강의 내용 정리/컴퓨터구조

728x90
반응형

Computer Organization & Performance

0. 프로그래머가 컴퓨터 구조에 대해 알아야하는 이유

1) Memory management 측면

메모리가 어디에 저장이 되는지 확인해야지 효율적으로 메모리를 관리 할 수 있다.

 

2) Thread management 측면

쓰레드간의 상호작용을 파악해야지 효율적으로 멀티 쓰레드를 관리할 수 있다.

 

3) 컴퓨터 개념

컴퓨터를 구성하는 세가지 주요 구성요소

- Computation

- Communication

- Storage/memory

 

4) 컴퓨터의 구성요소

- Input, Output / Secondary Storage / Primary Storage / Processor, Data path

 

 

 

1. 하드웨어의 발전 및 추세

1) 마이크로 프로세서의 발전 속도

- 초기(1986년 이전)에는 프로세서에 대한 투자가 이뤄지지 않았기 때문에 연 22% 정도씩 성능이 증가했다.

- 중기(1986년 이후 2003년 이전)에는 개인 컴퓨터가 보급됨에 따라 프로세서의 성능이 연 52% 가량 증가했다.

- 후기(2003년 이후)에는 쿨러의 문제 때문에 프로세서의 클락 레이트를 늘리기 보단 코어의 개수를 늘리는 방향으로 프로세서의 성능을 증가시키기에 약 연 22% 정도씩 성능이 증가했다.

- 펜티엄 이후로 클락 레이트의 비율이 늘어났다.

 

2) 주요한 트렌드

(1) 싱글 쓰레드의 성능 향상

(2) 파워 워는 복잡한 기능 추가하기 더 어렵게 만든다.

(3) 파워 워는 주파수 증가를 어렵게 만든다.

 

3) 프로세서 기술 추세

- 트렌지스터의 사이즈가 점점 작아지고 있다.

 

4) 메모리와 I/O 기술 추세

- DRAM의 저장 공간이 매년 40-60%씩 증가하고 있고, latency는 10년간 33%씩 줄어들고 있다.

- 저장 공간을 매우 크게 만들 경우에는 더 느려지기 때문에 DRAM이 많은 저장공간을 만드는 데의 장벽이 된다.

- Disk 저장 공간은 매년 2배씩 증가하고 있고, latency는 DRAM과 비슷하다.

 

 

 

2. 설계에 대한 평가 기준

1) 평가 기준 예시

- 기능적으로 만족하는가(사양을 지키는가)

- 호환가능한가

- 공간이 충분한가

- 비용이 저렴한가

- 확장 가능성이 있는가

- 사용자가 편리하게 사용할 수 있는가

.... 등등

-> 평가할 수 있는 기준은 상황에 따라서 더 우선순위가 되는 기능들이 있지만 일반적으로 평가할 수 있는 정량적인 지표가 존재한다.

 

 

2) Performance 측정 요소

(1) 대표적인 지표

i) Response time(latency): 프로그램을 동작시키는 데 걸리는 시간

ii) Throughput: 정해진 시간 내에 할 수 있는 일

-> 좋은 프로세서는 위의 두 가지 요소를 만족 시킴

 

 

(2) Performance 계산법

Performance(x) = 1 / execution time(x)

여기서 execution time은 response time을 의미한다.

 

 

- clock cycle은 performance에 영향을 미친다.

 

 

(3) Excution time 계산법

 

CPU execution time = CPU clock cycles (required for executing a program) x Clock cycle time

 

- Clock cycle time = 1 / Clock speed

- Execution time = clock cycle time × # instructions × avg CPI

- 실행시간이 짧을수록 더 좋은 performance를 가진다.

 

 

Quiz 1)

A: A program is converted into 4 billion MIPS instructions by a compiler; the MIPS processor is implemented such that each instruction completes in an average of 1.5 cycles and the clock speed is 1 GHz = 6 secs
B: The same program is converted into 2 billion x86 instructions; the x86 processor is implemented such that each instruction completes in an average of 6 cycles and the clock speed is 1.5 GHz = 8 secs

 

(4) SPEC

- 정량화된 performance 측정 기준으로 대표적인 12개의 integer 연산과 17개의 floating-point 연산에 대한 어플리케이션을 작동시켜서 이를 테스트한다.

- 시스템의 성능을 측정하기 위한 benchmark suites이다.

 

(5) Common Principles

- Energy: 시스템을 켜놓기만해도 에너지 누수가 발생하는 특징이 있는데 performance의 향상은 energy도 향상된다.

- 90-10 rule: 10%의 프로그램이 90%의 실행 시간을 담당한다. 이를 알고 있으면 10%에 대해 최적화를 진행하면 된다는 점도 알 수 있다.

- principle of locality: 같은 데이터, 같은 코드가 다시 사용될 가능성이 굉장히 높고(temporal locality), 그 코드 옆에 있는 코드들도 사용할 가능성이 굉장히 높다.(spatial locality)

 

 

Quiz 2)

A 1 GHz processor takes 100 seconds to execute a program, while consuming 70 W of dynamic power and 30 W of leakage power. Does the program consume less energy in Turbo boost mode when the frequency is increased to 1.2 GHz?

Normal mode energy = (70+30) W x 100s = 10,000 J

Turbo mode energy = (70 x 1.2 + 30) W x 100 / 1.2 = 9,500 J

-> 일반적으로 performance의 향상은 energy의 향상도 이뤄냄
 

결론

- 하드웨어의 퀄리티가 소프트웨어의 performance를 향상시킬 수 있다.

- 최근에는 멀티 코어를 통해 성능을 향상시키는 것이 트렌드이다.

- 성능에 대한 판단 기준은 clock speeds, CPIL, benchmark suites, performance equations 등으로 체크할 수 있다.

 

Quiz 3)

Processor X has a clock speed of 1GHz and takes 1 cycle for integer operations, 2 cycles for memory operations, and 5 cycles for floating-point operations. Empirical data shows that programs run on Processor X typically are composed of 40% floating-point operations, 30% memory operations, and 30% integer operations. You are designing Processor X-v 2, an improvement on Processor X which will run the same programs and you have 2 options to improve the performance.

* 여기서 Speed up은 기존에 있는 프로세서에서 얼마나 빨라졌는지를 고려함

a) Increase the clock speed to 1.4 GHz, but memory operations take 4 cycles
b) Decrease the clock speed to 0.8 GHz, but floating-point operations only take 2 cycles
Please compute the speed up for both options and decide the option Processor X-v 2 should take

 

풀이

performance of processor X = 1/execution time of processor X

Execution otime of processor X = 1/clock speed x the number of cycle

the number of cycle = 0.4 x 5 + 0.3 x 2 + 0.3 x 1 = 2.9

Execution time X = (1/1GHz) x 2.9 = 2.9ns

 

a) Execution time of A = (1/1.4GHz) x (0.4 x 5 + 0.3 x 4 + 0.3 x 1)  = 2.5ns. Speed up = execution time of X / execution time of A = 1.16

b) Excution time of B = (1/0.8) x (0.4 x 2 + 0.3 x 2 + 0.3 x 1) = 2.2125ns. Speed up = execution time of X / execution time of B = 1.36배 빨라진다.

-> B가 더 좋다.

728x90
반응형