sollog

[CA] - Hazard 본문

자기계발/Study

[CA] - Hazard

Solmi Kim 2023. 12. 12. 03:19
728x90
반응형

오늘은 컴퓨터구조에서 발생하는 hazard에 대한 내용을 다루고자한다.

딱 들었을때 단어의 어감이 어떤가? 별로다!

 

맞다. 하자드는 다음 인스트럭션이 실행할 수 없을때 발생하는 녀석이다. 따라서 위험하다.

 

Hazard : The situation when the next instruction cannot be excuted in the following clock cycle.

 

1. Structural Hazard (구조적인 문제) - Hardware cannot support combination of instruction.

하드웨어가 인스트럭션 결합에 지지를 할 수 없을때

 

EX) The instruction and data should be fetched from the memory at the same time.

EX) 설치 및 데이터는 동시에 메모리에 가져와야 합니다.

 

 

2. Data Hazard (데이터 문제)  : An instruction depends on the result of a previous instructions still in pipeline.

설치는 파이프라인에 따라 이전 지침의 결과들에 따라 달라집니다.

 

업데이트가 느린 경우에 발생해. 이전의 instruction이 아직 파이프라인에 남아있어서, 결과를 받아올 수 없는 경우임

 

Problem with starting next instruction before first is finished

- dependencies that go backward in time are data hazards.

 

첫 번째 지침을 완료하기 전에 다음 지침을 사용하는 건 좀 ..! 그렇다 마 

 

3. Control Hazard (제어 문제): Control may be transferred to another instruction based on the results of an instruction

 

-> All the Hazard can be resolved by waiting . 모든 hazard는 대기를 통해 해결할 수 있음.  waiting, stall, freeze (같은의미)

-pipeline control must detect the hazard. pipeline control이 위험을 감지해야함. 

-take action (or delay action) to resolve hazards. 위험 조취를 해결 

 

Control (Branch) Hazard Example 

 

 

 

그럼 각각의 해결방법을 찾아보자.

 

Solutions 

 

1. Structural Hazard (구조적인 문제)

*같은 clock cycle안에서 같은 resource를 access 하려고 할 때 발생함. 

 

Resource Duplication  

-Seperate I and D memories (caches) for memory access conflict. 메모리를 분리함 

- Time-multiplexed or multi-port register file for register file access conflict. 동시에 읽고쓸 수 있게 구성 

 

2.  Data Hazard (데이터 문제) // 자세한 예시는 4장의 51페이지를 참고하기 

- Freezing the pipeline (waiting,stall) instructions을 실행안하고 가만히 있는 것.

- (Internal) Forwarding

- Compiler scheduling 

 

 

3. Control Hazard (제어 문제)

- Stall 

- Optimized branch processing

       1) Find out branch taken or not early.  브랜치 여부를 빨리 결정하자.

        -> simplified branch condition

       2) Compute branch target address early

        -> extra hardware 

- Branch prediction

- Delayed branch 

 

 

 

 

 

728x90
반응형

'자기계발 > Study' 카테고리의 다른 글

codeit - 프로그래밍 시작하기 in Python  (0) 2024.01.04
PA - 알고리즘 문제 풀이  (1) 2023.12.30
[CA] - Improving cache performance  (0) 2023.12.01
[CA] - Basics of cache  (0) 2023.11.30
[CA] - Memory hierarchy general  (0) 2023.11.30