The CPU and the fetch-execute cycle
แนะนำใหม่
11:47
ซีพียู
โปรเซสเซอร์ในโทรศัพท์ของคุณกำลังทำอะไรบางอย่างที่ง่ายจนแทบจะโง่เขลา ดึงคำสั่งหนึ่งมา คำนวณว่ามันหมายถึงอะไร ทำมันให้เสร็จ แล้วดึงคำสั่งถัดไป That is…
บรรยายภาษาอังกฤษ · สลับคำบรรยายภาษาอังกฤษและภาษาจีนได้
ในบทเรียนนี้
| English | ความหมาย |
|---|---|
| CPU/ˌsiː piː ˈjuː/ | หน่วยประมวลผลกลาง |
| data/ˈdeɪtə/ | Recorded facts, observations or values used for analysis or processing. |
| instructions/ɪnˈstrʌkʃnz/ | คำสั่ง |
| ALU/ˌeɪ el ˈjuː/ | หน่วยคำนวณและตรรกะ |
| control unit/kənˈtrəʊl ˈjuːnɪt/ | หน่วยควบคุม |
| registers/ˈredʒɪstəz/ | รีจิสเตอร์ |
| buses/ˈbʌsɪz/ | บัส |
| program/ˈprəʊɡræm/ | A set of instructions specifying operations for a computer to carry out. |
| fetch–execute cycle/fetʃ ˈeksɪkjuːt ˈsaɪkl/ | The repeating process of obtaining an instruction, decoding it and carrying out the required operation. |
| logical comparisons | |
| control signals | |
| memory/ˈmeməri/ | Circuits that store data, such as registers, RAM and ROM. |
| address/əˈdres/ | An identifier specifying a location in memory or on a network. |
| chip | |
| Fetch | |
| Execute/ˈeksɪkjuːt/ | |
| PC | |
| MAR | |
| MDR | |
| CIR | |
| ACC | |
| Decode | |
| cache/kæʃ/ | แคช |
| embedded system/emˈbedɪd ˈsɪstəm/ | ระบบฝังตัว |
| cores/kɔːz/ | Processing units within a processor that can execute instruction streams. |
| cache size | |
| clock speed/klɒk spiːd/ | The number of cycles of a processor's clock per second; it alone does not determine how quickly every program runs. |
| Storage/ˈstɔːrɪdʒ/ | |
| secondary storage/ˈsekəndəri ˈstɔːrɪdʒ/ | Non-volatile storage used to retain data and programs beyond immediate processing. |
| program counter/ˈprəʊɡræm ˈkaʊntə/ | A processor register holding the address of the next instruction to fetch in the simplified CPU model. |
| address bus/əˈdres bʌs/ | The signal lines used to identify a memory location or device involved in a transfer. |
| data bus/ˈdeɪtə bʌs/ | The signal lines carrying data between processor, memory and other connected components. |
| accumulator/əˈkjuːmjʊleɪtə/ | A register used to hold intermediate arithmetic or logical results during processing. |
หน่วยประมวลผลกลาง (The central processing unit)
- CPU ประมวลผลข้อมูลและดำเนินการตาม instructions, ซ้ำรอบการทำงาน.resulting in millions of times per second.
- ภายในประกอบด้วย ALU, control unit และ registers เชื่อมต่อกันโดย buses
- ระบบจะรันโปรแกรมทุกอย่างผ่าน รอบดึง-ดำเนินการ
ส่วนประกอบของ CPU
- ALU — ทำการคำนวณและการเปรียบเทียบเชิงตรรกะ
- Control unit (CU) — ส่งสัญญาณควบคุมเพื่อจัดการทุกส่วน
- Registers — พื้นที่เก็บข้อมูลขนาดเล็กมากและเร็วพิเศษ เก็บค่าหนึ่งค่าต่อตัว
- Buses สามชนิดเชื่อมต่อกับหน่วยความจำ: address (ทางเดียว), data (สองทาง), control


CPU รุ่นปัจจุบันเป็นชิปเดียวที่รวม control unit, ALU และ registers ไว้ด้วยกัน


The ALU in a CPU:
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
The arithmetic logic unit does the maths and logic; the control unit manages the parts.
Registers และ fetch–execute cycle
- Registers พิเศษ: PC (ที่อยู่ของ instruction ถัดไป), MAR (ที่อยู่ที่ต้องการเข้าถึง), MDR (ข้อมูล/instruction ที่ดึงมา), CIR (instructionที่กำลังทำงาน), ACC (ผลลัพธ์ของ ALU)
- Cycle นี้ซ้ำสามขั้นตอน: Fetch (คัดลอก instruction เข้า CPU แล้ว PC + 1) → Decode (CU วิเคราะห์ความหมาย) → Execute (ดำเนินการตามนั้น)

Fetch–decode–execute cycle ที่ CPU ทำซ้ำสำหรับทุก instruction

รอบ fetch-execute
Tap round the loop the CPU repeats billions of times a second — fetch the instruction, decode what it means, execute it, then do it all again.
Match each CPU part to what it does.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
The ALU computes, the control unit directs, the PC tracks the next instruction, and cache keeps hot data close.
Put the stages of the cycle in order.
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Fetch the instruction, decode what it means, then execute it — repeated continuously.
Cache, ประสิทธิภาพ, ระบบฝังตัว (Embedded systems)
- Cache เป็นหน่วยความจำขนาดเล็กมากและเร็วอยู่ใกล้ CPU เก็บข้อมูลที่ใช้บ่อย — เพื่อให้ CPU รอได้น้อยลง
- ประสิทธิภาพขึ้นอยู่กับจำนวน cores, cache size, และ clock speed (รอบต่อวินาที)
- Embedded system คือคอมพิวเตอร์ขนาดเล็กที่ฝังอยู่ในอุปกรณ์สำหรับงานเฉพาะอย่าง (เครื่องซักผ้า, ไมโครเวฟ)

Cache และ main memory (RAM) อยู่ใกล้ CPU เพื่อดำเนินการจ่ายข้อมูลให้เร็ว


Which change would improve CPU performance?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
More cores, a larger cache and a higher clock speed all improve performance.
Cache is small, very fast memory near the CPU that holds often-used data, so the CPU waits less than it would reading from main memory.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A bigger cache, more cores and a higher clock speed all raise performance — cache helps by cutting the wait for data.
การ์ดนี้เป็นการ์ดใหม่ จึงแสดงเป็นภาษาอังกฤษจนกว่าคำแปลจะพร้อม
Worked example: one trip round the cycle
The program counter 程序计数器 (PC) holds 20. Describe how the next instruction is fetched.
- The address 20 is copied from the PC to the MAR and sent along the address bus 地址总线 to memory. The instruction stored at address 20 comes back along the data bus 数据总线 into the MDR, then is copied to the CIR.
- The PC goes up by 1, to 21, ready for the next fetch. The control unit then decodes the instruction in the CIR, and it is executed (the ALU does any calculation, with the result in the accumulator 累加器).
Which register holds the address of the next instruction to be fetched?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
The PC holds the next address and is incremented after each fetch.
Doubling the number of cores always makes every program run twice as fast.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Only tasks that can be split between cores speed up, and the cores must share work and memory.
คุณเข้าใจแล้ว
- CPU = ALU (คณิตศาสตร์/ตรรกะ) + CU (สัญญาณควบคุม) + registers, เชื่อมต่อกันโดย address/data/control buses
- register สำคัญ: PC (คำสั่งถัดไป), MAR/MDR (หน่วยความจำ), CIR (ปัจจุบัน), ACC (ผลลัพธ์)
- วงจร: fetch → decode → execute
- ประสิทธิภาพ: cores, cache size, clock speed; cache = หน่วยความจำเร็วใกล้ CPU
เกิดปัญหาอะไรขึ้น? เฉพาะทีมเว็บไซต์เท่านั้นที่เห็นข้อมูลนี้