수정입니다

Memory Hierarchy(1) - Disk access time 본문

전공/컴퓨터구조

Memory Hierarchy(1) - Disk access time

nongdamgom 2023. 12. 28. 12:37

메모리에는 계층이 존재

SRAM(cache in CPU) --> DRAM(main memory) -- SSD -- Magnetic disk(HDD)

(fastest,expensive) ---------------------------------------------> (slowest, cheap)

GOAL

"size of the cheapest memory, with speed of fastest memory"

Principle of Locality

  • programs(sw) access a small propotion of their address space(memory) at any time

  1. Temporal locality(Time)
  • 가장 최근에 접근했던 걸 다시 접근할 확률이 높다 ex) loop, variable

2. Spatial locality(space/location)

  • 가장 최근에 접근한거 근처에 있던 걸 다시 접근할 확률이 높다 ex)연속적인 데이터(배열 같은)

Taking Advandage of Locality

memory hierarchy

  1. store everything on disk (lowest level)
  2. Copy recently accessed(and nearby) items from disk to smaller DRAM memory
  3. Copy more recently accessed(and nearby) items from DRAM to smaller SRAM memory

=> 계층 맨 아래(lowest level)는 모든 data가 다 있음

=> data는 오직 가장 인접한 곳에 있는(바로 윗 단계) 계층으로만 copy 될 수 있음

=> 그렇게 아래서부터 타고타고 올라가서 CPU에 전달,

--> CPU always use fastest memory first.

Memory Hierarchy Levels

  • A block(aka line) : unit of copying
  • If accessed data is present in upper level

--> Hit (Hit ratio : hits/accesses)

  • If accessed data is absent

--> Miss :block copied from lower level

=> time taken : miss penalty, Miss ratio : misses/accesses(1-hit ratio)

CPU가 가장 빠른 메모리(그러니까 cache)에 먼저 접근 후,

여기에 있다? -> hit

여기에 없다? -> miss, 그 바로 아래 메모리에 접근 해서 또 확인

  • 있으면 cache로 copy, 그리고 그 copy한걸 cache가 cpu에 전달
  • 없으면 또 그 아래 메모리로 접근 ----- 이렇게 계속 찾아내려감(점점 느려진다)

Memory Technology

SRAM -- DRAM -- Magnetic disk

하나씩 내려갈때마다 100배로 빨라지고 100배로 비싸짐

등등등... 여러가지 기술 이슈가 있음

flash storage : non-volatile semiconductor storage

  • disk와 DRAM 사이 그 어딘가...
  • flash bits wears out after 1000's of accesses
  • 빨리 고장나는듯?

Disk Sectors and Access

disk에서 찾고 싶은 sector가 가진 정보

  • Sector ID
  • Data
  • Error correcting code(ECC)
  • Synchronization fields and gaps

이런 정보를 기록함.. 그리고 head가 disk의 track 따라 돌면서 right track을 찾는다... 빙글빙글 돌면서...

Access to a sector involves

  • Queuing delay (다른 프로그램이 쓰는걸 기다리는 시간)
  • seek : move the heads (실린더에 head를 위치시키는 시간)
  • rotational latency : head에 원하는 sector가 놓이게 회전시키는 시간
  • data transfer (copy time)
  • controller overhead

Disk Access Example

*틈새 상식 

B -> KB(2^10 B) -> MB(2^20 B) -> GB(2^30 B) ->TB (2^40 B)

s -> ms(10^-3s) -> ㎲(10^-6s) -> ps(10^-9s) -> fs(10^-12s)

Given

512B sector, 15,000 rpm, 4ms average seek time, 100MB/s transfer rage, 0.2ms controller overhead, idle disk

512B sector -> data size

15,000 rpm -> 15000 rotations/min = 250rota/sec ---> 1rotation = 0.004s = 4ms

4ms average seek time

100MB/s transfer rate -> copying time

idle disk -> no one is using the disk (no queuing delay)

Average read time

4ms seek time

+ 1/2(uniform avg)/ 4ms = 2ms avg rotational latency

+ 512/100MB/s = 0.005ms transfer time

+ 0.2ms controller delay

= 6.2ms

Disk performance Issues

  • Manufactures quote average seek time

--> Locality and OS scheduling lead to smaller actual average seek times

  • Smart disk controller allocate physical sectors on disk
  • Disk drives include caches

--> avoid seek and rotational delay

'전공 > 컴퓨터구조' 카테고리의 다른 글

Memory Hierarchy(4) - virtual memory  (0) 2023.12.28
Memory Hierarchy(3) - Cache_2, Hamming code  (0) 2023.12.28
Memory Hierarchy(2) - Cache_1  (0) 2023.12.28
Pipelining(2)  (0) 2023.12.28
Pipelining(1)  (1) 2023.12.28