일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 컴퓨터공학
- 코드잇
- 방학
- 제품증정 #에스트라 #에스트라퓨처랩서포터즈 #리제덤아이세럼 #더마아이세럼 #레티노이드아이세럼
- 코드잇파이썬
- 졸업영어
- 컴퓨터구조개념
- CA
- computerarchitecture
- .env파일
- 책평가
- 백엔드
- 맥북FaceID
- 스프링부트개발
- JS
- 나는주니어개발자다
- 컴퓨터구조
- codeit
- 소프트웨어
- Python
- 코멘토취업
- 말하기시험
- 개발자
- 함꼐자라기
- 코멘토5주인턴
- 개발
- 파이썬
- 스프링장점
- MIPS
- 컴퓨터공학과
- Today
- Total
sollog
[CA] - Memory hierarchy general 본문
- Large vs. Fast
- Principle of locality
- There is a conflict having large and fast memory.
크고 빠른 메모리를 가지고 있는 충돌이 있습니다.
- Large Memory is slow and fast memory is small.
Large Memory는 느리고 빠른 메모리는 작습니다.
= Recall that " smaller is faster " (principle)
=> 작을수록 빠릅니다.
- but, users wants large and fast memory
SRAM (Static) access time are 0.5ns~ 2.5ns at cost of $20000 - $5000 per GB
DRAM (Dynamic) access times are 50ns ~ 70ns at cost of $20 - $75 per GB
Disk access times are 5 ms - 20ms at cost of $0.20 - $2 per GB
Ideal memory
- Access time of SRAM
- Capacity and cost/GB of disk
- 캐시에 저장할 데이터가 지역성(Locality)을 가져야 한다.
- 지역성이란, 데이터 접근이 시간적, 혹은 공간적으로 가깝게 일어나는 것을 의미한다.
- 지역성의 전제 조건으로 프로그램은 모든 코드나 데이터를 균등하게 Access하지 않는다는 특성을 기본으로 한다.
- 즉, 지역성(Locality)이란
기억장치 내의 정보를 균일하게 Access하는 것이 아닌 어느 한 순간에 특정 부분을 집중적으로 참조하는 특성이다.
Locality 캐시의 지역성
1) temporal locality (시간적 지역성) : the same item will tend to be referenced again soon.
특정 데이터가 한 번 접근되었을 경우, 곧 또 한 번 데이터에 접근할 가능성이 높아지는 특성
메모리 상의 같은 주소에 여러 차례 읽기, 쓰기를 수행 할 경우에, 상대적으로 작은 크기의 캐시를 사용해도 효율성을 꾀할 수 있다.
ex)
a = b + c ; //여기서 a는 쓰기이다.
d = 2*a+1 ; // 여기서 a는 읽기이다.
2) spatial locality (공간적 지역성) : nearby items will tend to be referenced soon.
기억장치 내에 서로 인접하여 저장되어 있는 데이터들이 연속적으로 액세스 될 가능성이 높아지는 특성
table, 배열 데이터들이 저장되어 있는 기억장치 영역은 그들에 대한 연산이 수행되는 동안에 집중적으로 접근 된다.
ex)
for(i=0; i<10; i++)
sum = sum + a[i]; // 여기서 sum은 temporal locality(시간적 지역성), a[i]는 spatial locality (공간적 지역성) 이다.
Taking Advantage of Locality
- Memory hierarchy
- Store everything on disk
- Copy recently accessed (and nearby) items from disk to smaller DRAM memory
Main memory
- Copy more recently accessed (and nearby) items from DRAM to smaller SRAM memory
Cache memory attached to CPU
Basic Stucture of a Memory Hierarchy
Our initial focus : two levels (upper, lower)
- block : minimum unit of data ( several wrods in cache memory) // 단위라고 생각하면 돼
- hit : data requested is in the upper level // processor cache memory에 data를 찾으러 갔는데 데이터 있는 경우
- miss : data requested is not in the upper level // 없는 경우
=> miss의 경우, block that contains the requested data should be loaded into uppder memory -> CPU stalls -> very time consuming process -> performance degrade (miss가 많이 일어나면 performance가 저하돼 )
-each pair of levels in the memory hierarchy can be thought of as having an upper and lower level.
// 메모리 계층의 각 레벨 쌍은 상위 레벨과 하위 레벨을 갖는 것으로 간주될 수 있습니다.
'자기계발 > Study' 카테고리의 다른 글
[CA] - Improving cache performance (0) | 2023.12.01 |
---|---|
[CA] - Basics of cache (0) | 2023.11.30 |
[CA] - ch4 The Processor (0) | 2023.11.08 |
실수를 기회삼아 (0) | 2023.11.05 |
DM 3 (0) | 2023.10.18 |