성능, fetch-execute 사이클 및 인터럽트
도입됨
21:25
폰 노이만 아키텍처
역사 대부분 동안 기계는 하나의 작업만 수행했습니다. 직조기는 천을 짜고, 계산기는 더했습니다. 새로운 작업을 하게 하려면 재설계해야 했습니다. 그러다 기만적으로 간단한…이 등장했습니다.
영어 내레이션 · 영어와 중국어 자막 전환 가능
이 수업의 내용
| English | 의미 |
|---|---|
| processor/ˈprəʊsesə/ | The component that executes instructions and performs the operations of a computer or similar system. |
| cycles | Repeated sequences of steps the processor follows to fetch and execute instructions. |
| instruction/ɪnˈstrʌkʃn/ | A command that tells the processor what action to perform. |
| interrupt/ˈɪntərʌpt/ | 인터럽트 |
| Clock speed/klɒk spiːd/ | More fetch-execute cycles a second, so more instructions a second, until heat sets the limit. |
| Execute/ˈeksɪkjuːt/ | Arithmetic and logic go to the ALU with the result in the ACC. |
| Number of cores/ˈnʌmbə ɒv kɔːz/ | The total count of independent processing units in a processor. |
| threads | Separate sequences of instructions that a processor can run independently. |
| parallel/ˈpærəlel/ | Describing operations that take place concurrently rather than one after another. |
| cores/kɔːz/ | 코어 |
| Bus width | A wider data bus moves more bits per transfer, so fewer transfers. |
| data bus/ˈdeɪtə bʌs/ | The signal lines carrying data between processor, memory and other connected components. |
| bits/bɪts/ | A binary digit, taking the value zero or one. |
| address bus/əˈdres bʌs/ | The signal lines used to identify a memory location or device involved in a transfer. |
| memory/ˈmeməri/ | Circuits that store data, such as registers, RAM and ROM. |
| Cache/kæʃ/ | A small, fast memory next to the processor holding the instructions and data used most recently, so fewer slow trips to RAM . Word size , the amount of RAM and the storage type help too. |
| RAM/ræm/ | Random-access memory used for working data and instructions, usually losing its contents when power is removed. |
| Word size/wɜːd saɪz/ | The number of bits a processor can handle as one unit. |
| working set | The instructions and data a program is currently using or likely to need. |
| port/pɔːt/ | 포트 |
| peripheral/pəˈrɪfərəl/ | 주변기기 |
| USB | A general-purpose connection for transferring data and supplying power to devices. |
| plug-and-play | Describes a device that a computer detects and sets up automatically. |
| load/ləʊd/ | To move data or a program into memory or a register. |
| driver/ˈdraɪvə/ | Software that allows the operating system to communicate with a device. |
| HDMI | A connection that carries digital video and audio through one cable. |
| digital video | Moving images represented by numbers that a computer can process. |
| audio | Sound represented as a signal that can be stored or transmitted. |
| analogue/ˈænəlɒɡ/ | Describes a signal that changes continuously and can take any value within a range. |
| VGA | An older connection that carries analogue video to a display. |
| fetch-execute cycle/fetʃ ˈeksɪkjuːt ˈsaɪkl/ | 取指-执行周期 |
| register transfer notation/ˈredʒɪstə ˈtrænsfɜː nəʊˈteɪʃn/ | 寄存器 전송 기법 |
| read signal | A signal telling memory to send back data from a given address. |
| control bus/kənˈtrəʊl bʌs/ | The signal lines carrying control and timing information, such as read, write or interrupt signals. |
| address/əˈdres/ | An identifier specifying a location in memory or on a network. |
| PC | A register holding the address of the next instruction to fetch. |
| jump/dʒʌmp/ | An instruction that changes the address of the next instruction to fetch. |
| MAR | A register holding the address of a memory location being accessed. |
| MDR | A register holding data being transferred to or from memory. |
| CIR | A register holding the current instruction while it is decoded and executed. |
| Decode | The control unit works out from the instruction in the CIR which operation it is and where its operands are. |
| control unit/kənˈtrəʊl ˈjuːnɪt/ | The part of the processor that decodes instructions and controls their execution. |
| operation/ˌɒpəˈreɪʃn/ | The action that an instruction tells the processor to perform. |
| operands | Values used by an operation to produce a result. |
| arithmetic/əˈrɪθmətɪk/ | Calculations with numbers, such as adding and subtracting. |
| logic/ˈlɒdʒɪk/ | Operations that use rules to combine or change binary values. |
| ALU/ˌeɪ el ˈjuː/ | The part of a processor that performs arithmetic and logical operations. |
| ACC | A register that holds results of arithmetic and logic operations. |
| store/stɔː/ | To move data from a register into a memory location. |
| register/ˈredʒɪstə/ | A small, fast storage location within a processor used to hold data, addresses or instructions temporarily. |
| memory location | A place in memory that holds data and has an address. |
| signal/ˈsɪɡnl/ | Information or cues that communicate a condition and can influence a response or decision. |
| buffer/ˈbʌfə/ | A temporary area of memory used to hold data while it is transferred or processed. |
| network packet | A small unit of data sent across a computer network. |
| software fault | An error in software that causes a problem during a program's execution. |
| illegal instruction | An instruction that the processor cannot recognise or is not allowed to execute. |
| arithmetic overflow | A result that is too large or small for the available number of bits. |
| operating system/ˈɒpəreɪtɪŋ ˈsɪstəm/ | System software that manages hardware resources and provides services for applications. |
| timer/ˈtaɪmə/ | A hardware counter in a microcontroller used to measure time or produce regular events. |
| time slice/taɪm slaɪs/ | A short interval of processor time allocated to a task before another task may run. |
| multitasks | Runs multiple tasks by switching between them so they appear to run together. |
| state/steɪt/ | The saved information needed to continue a program from its current point. |
| stack/stæk/ | 스택 |
| interrupt service routine/ˈɪntərʌpt ˈsɜːvɪs ruːˈtiːn/ | 중단 서비스 routine |
| input device/ˈɪnpʊt dɪˈvaɪs/ | A device that sends data or instructions to a computer for processing. |
| interrupt signal | A signal that asks the processor to respond to an event. |
| flag/flæɡ/ | A bit that records whether a particular condition or event has occurred. |
| interrupt register/ˈɪntərʌpt ˈredʒɪstə/ | 중단 레지스터 |
| priority/praɪˈɒrɪti/ | The level of importance that decides which task or interrupt is handled first. |
키를 누르면 노트북이 모든 것을 멈추게 되는 이유
- A processor runs billions of cycles a second. If it had to stop and ask the keyboard "anything yet?" between instructions, it would waste most of them asking.
- 대신 키보드는 인터럽트를 보냅니다. 프로세서는 현재 명령어를 마치고, 자신의 위치를 보존한 뒤 키를 처리하고, 아무 일도 없었던 것처럼 복귀합니다.
- 하나의 메커니즘이 단일 프로세서를 통해 음악 재생, 브라우저 실행, 키보드 입력 등을 동시에 수행하는 것처럼 보이게 합니다.
- 이 수업에서는 프로세서를 빠르게 만드는 요소, 장치에 연결되는 방식, 한 명령어를 정확히 실행하는 방법, 그리고 인터럽트가 개입하는 방법을 다룹니다.
성능에 영향을 미치는 요소
- Clock speed: more fetch-execute cycles a second, so more instructions a second, until heat sets the limit.
- 코어 수: 각 코어가 동시에 자체 명령어를 가져와 실행하므로 여러 프로그램이나 스레드가 병렬로 실행됩니다. 프로그램을 코어를 사용하도록 작성해야 하므로, 코어 수를 두 배로 늘린다고 속도가 두 배가 되지는 않습니다.
- 버스 폭: 더 넓은 데이터 버스는 한 번 전송 시 더 많은 비트를 처리하므로 fewer transfers; 더 넓은 주소 버스는 더 많은 메모리에 접근할 수 있다.
- 캐시: 프로세서 옆에 있는 작고 빠른 메모리로, 가장 최근에 사용된 명령어와 데이터를 저장하여 RAM으로 가는 느린 이동 횟수를 줄인다. 워드 크기, RAM 용량 및 저장 매체 유형도 기여한다.
CPU 성능에 영향을 미치는 요인을 모두 선하십시오.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
클록 속도, 코어, 캐시(또는 워드 크기, RAM, 저장 장치, 버스 폭)는 모두 성능에 영향을 미칩니다. 케이스 색상은 영향을 주지 않습니다.
멀티코어 CPU는 특히 다음에 유용합니다:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
추가 코어는 작업을 병렬로 처리합니다. 순수한 시스레드 작업은 코어별 속도가 높아지는 것보다 더 큰 이점을 얻습니다.
____ 메모리는 프로세서 옆에 위치한 작고 빠른 저장 장치로, 최근에 사용된 명령어와 데이터를 보관하여 RAM으로 가는 느린 왕복 횟수를 줄입니다.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
더 많은 캐시는 작동 집합의 더 많은 부분이 프로세서 옆에 있어 성능 비교에서 항상 등장하는 이유입니다.
worked example: "새 컴퓨터가 더 빠른 이유 설명"
- 두 사양을 줄별로 비교하고, 각 항목마다 그 이유를 명시한다.
- 3.8 GHz 대 2.4 GHz: 초당 더 많은 사이클이므로 초당 더 많은 명령어를 실행한다.
- 8 코어가 4 코어보다 많으면, 이를 지원하는 소프트웨어에게 동시에 더 많은 인스트럭션을 가져오고 실행할 수 있게 합니다.
- 16 MB 캐시 대 4 MB: 작업 세트의 더 큰 부분이 프로세서 옆에 유지되므로 RAM 대기 시간이 줄어든다. 각 줄은 두 점(인자 및 결과)을 반영한다.

포트
- 포트는 주변 장치를 연결하는 물리적 소켓이다.
- USB(Universal Serial Bus)는 범용端口: 키보드, 드라이브, 휴대폰 등. 플러그 앤 플레이: 컴퓨터가 장치를 감지, 식별, 드라이버를 로드하며 재부팅 없이 전원을 공급할 수 있다.
- HDMI(High Definition Multimedia Interface)는 디지털 영상과 음성을 하나의 케이블로 전송하므로 아날로그 변환 없이 영상이 저하되지 않는다. VGA(Video Graphics Array)는 구형 아날로그 영상 포트이다.
각 포트가 전송하는 데이터를 연결하십시오.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
신호와 소켓이 다릅니다: HDMI 케이블은 USB 포트에 꽂히지 않습니다.
.fetch 단계
- 명령어마다 한 번씩 프로세서는 fetch-execute cycle을 수행한다. Fetch가 먼저 오며, 시험에서는 이를 레지스터 전달 기법으로 요구한다.
MAR ← [PC] the address of the next instruction goes to the MAR
PC ← [PC] + 1 the PC now points to the following instruction
MDR ← [[MAR]] the instruction at that address is read into the MDR
CIR ← [MDR] the instruction is copied into the CIR for decoding
- 읽기 신호가 제어 버스를 통해 전달되고, 주소는 주소 버스를 통해, 명령어는 데이터 버스를 통해 돌아온다. PC는 주소가 복사된 직후 즉시 증가되며, 나중에 실행되는 점프가 이를 덮어쓸 수 있도록 한다.

PC → MAR → 메모리 → MDR → CIR 순으로 진행되며, 그 과정에서 PC는 증가됩니다

메이커 단계의 단계를 올바른 순서로 배치하십시오.
난이도 3/5 · 200코인 + 오늘 첫 완료 시 작은 보너스 추가
PC → MAR, PC 증가, 읽기 신호, 이후 명령어는 MDR → CIR로 이동하여 디코딩 준비 완료.
PC는 메이커 단계 중 증가되어 다음 사이클에서 다음 명령어를 가져오게 됩니다.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
PC를 일찍 증가시키면 해당 명령어가 실행될 때 이미 다음 명령어를 가리키고 있습니다(점프가 변경하지 않는 한).
Decode, execute, repeat
- Decode: 제어 유닛이 CIR의 명령어에서 어떤 연산인지와 피연산자의 위치를 파악한다.
- Execute: 산술 논리 연산은 ALU로, 결과는 ACC에 저장됩니다. load 또는 store는 메모리와 레지스터 간 데이터 이동을, 점프는 새로운 주소를 PC에 기록한다.
- 이후 주기는
MAR ← [PC]부터 반복됩니다. 매 주기의 끝에서 프로세서는 인터럽트가 대기 중인지도 확인합니다.
한 번의 LOAD와 한 번의 ADD는 레지스터를 거치며: fetch, decode, execute, repeat
Fetch-execute 사이클
CPU는 초당 수십억 번 루프를 반복합니다. PC/MAR/MDR/CIR 레지스터를 사용하여 포치하는 과정과, 포치된 데이터를 기반으로 디코드 및 실행이 어떻게 이루어지는지 관찰하십시오.
worked example: 기법으로 두 명령어 실행
LDD 200(주소 200의 내용을 ACC로 로드)를 실행하세요:MAR ← 200, 그 다음MDR ← [[MAR]], 그 다음ACC ← [MDR].ADD 201를 실행하세요:MAR ← 201,MDR ← [[MAR]],ACC ← [ACC] + [MDR].STO 202를 실행하세요:MAR ← 202,MDR ← [ACC],[[MAR]] ← [MDR].- 각 줄은 두 지점 사이의 값을 하나 이동시킨다. 이중 괄호는 항상 "MAR에 주소가 저장된 메모리 위치"를 의미한다.
LDD 200를 실행하는 레지스터 전이를 순서대로 배치하십시오.
난이도 3/5 · 200코인 + 오늘 첫 완료 시 작은 보너스 추가
주소를 MAR로, 해당 주소의 내용을 MDR로, 그 다음 적산기로 보냅니다.
인터럽트
- 인터럽트는 정상적인 주기를 일시 중단시켜 프로세서가 급박한 이벤트를 처리할 수 있도록 하는 신호입니다.
- 원인: 하드웨어 장치(키 입력, 프린터 버퍼 비우기, 네트워크 패킷 도착), 소프트웨어 오류(0으로 나누기, 불법 명령어, 산술 오버플로우), 운영체제의 타이머가 타임 슬라이스 종료 표시, 정전 경고 등.
- 인터럽트는 프로세서가 장치를 지속적으로 검사하지 않아도 시스템이 신속하게 응답할 수 있게 하며, 이는 운영체제 멀티태스킹 방식이다.

루프의 각 반복 끝에서 인터럽트 확인이 이루어지는 사이클

인터럽트(interrupt)란:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
인터럽트는 CPU가 긴급 이벤트를 처리할 수 있도록 메이커-실행 사이클을 일시적으로 중단하고, 이후 재개합니다.
다음 중 어떤 것이 인터럽트를 유발할 수 있습니까? 모든 적용 가능한 것을 선택하십시오.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
하드웨어 이벤트, 소프트웨어 오류, 운영체제 타이머 모두 인터럽트를 발생시킵니다. 루프 종료는 점프에 의해 처리되는 일반적인 프로그램 흐름입니다.
인터럽트 처리
- 현재 명령어를 완료한다. 상태 저장: PC 및 다른 레지스터의 내용을 스택에 저장한다.
- **인터럽트 서비스 루틴(ISR)**의 주소를 PC에 로드하고 실합니다. ISR가 해당 이벤트를 처리합니다.
- 스택에서 저장된 상태를 복원하고 중단된 프로그램을 정확히 중단되었던 지점으로 계속한다.

저장, 처리, 복원, 재개
인터럽트가 발생하면 CPU는 먼저 현재 명령어를 완료한 후:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
PC와 레지스터를 저장하고, 인터럽트 서비스 routine을 실행한 후 상태를 복원하여 이전 위치에서 계속합니다.
worked example: 4점 인터럽트 답변
- 입력 장치로부터의 인터럽트가 fetch-execute 사이클에서 어떻게 감지되고 처리되는지 설명하십시오.
- 장치는 인터럽트 레지스터에 플래그를 설정하는 인터럽트 신호를 보냅니다. 프로세서는 현재 명령어 실행이 완료된 후 모든 사이클의 끝에 해당 레지스터를 검사합니다.
- 플래그가 설정되어 있고 인터럽트의 우선순위가 현재 작업보다 높으면 PC와 다른 레지스터가 스택에 저장됩니다. ISR의 주소가 PC에 적재되고 해당 루틴이 실행됩니다.
- 완료되면 레지스터가 스택에서 복원되고中断된 프로그램이 재시작됩니다. 네 가지 요소를 이 순서대로 나열하십시오.

프로세서는 매 메이커-실행 사이클의 끝, 즉 현재 명령어가 완료된 후에 인터럽트를 확인합니다.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
이 타이밍이 상태를 깔끔하게 저장할 수 있게 합니다: 어떤 명령어도 반으로 완료된 상태로 남지 않습니다.
놓칠 수 있는 점
- PC는 실행 이후가 아닌 취사(Fetch) 단계에서 증가됩니다.
PC ← [PC] + 1를MAR ← [PC]바로 뒤에 두 번째로 배치하십시오. - Interrupts are checked at the end of a cycle, never in the middle of an instruction.
- 상태는 스택에 저장되었다가 다시 복원됩니다. "CPU가 멈춘다" 또는 "프로그램이 사라진다"는 표현은 틀렸습니다: 정확한 위치에서 재개됩니다.
- 코어가 더 많다고 해서 속도가 두 배가 되는 것은 아닙니다. 소프트웨어가 이를 사용해야 합니다. 사양을 비교할 때는 반드시 이 점을 언급하십시오.
이해했습니다
- 성능: 클럭 속도, 코어 수, 버스 너비, 캐시(또는 단어 크기, RAM, 저장 장치) 및 각 항목이 가져오는 결과
- 포트: USB(일반 용도 및 플러그 앤 플레이), HDMI(디지털 영상 및 오디오), VGA(아날로그 영상)
- 페치:
MAR ← [PC],PC ← [PC] + 1,MDR ← [[MAR]],CIR ← [MDR]; 이후 디코드, 실행, 반복 - 인터럽트는 각 사이클 말에 확인됩니다: 스택에 상태 저장, ISR 실행, 복원, 재개
어떤 문제가 있었나요? 사이트 팀만 이 내용을 볼 수 있습니다.