انتقل إلى المحتوى
cookie

Eduqas GCSE Computer Science

GCSE · EduqasComputer Science21 ملاحظة في 7 مجلدات، 77 KB

21 ملاحظات للمذاكرة، أعدّها cookie، في 7 أقسام تتبع موضوعات المنهج.

Notes for Eduqas GCSE (9-1) Computer Science (C500QS), in folders for the course's content areas in the specification's order: hardware and logic, networks and security, data representation, software and algorithms, the impacts of technology, and programming in Python. Delete any folder your course leaves out once the notes are yours.

ما المحتوى؟

الملاحظة الأولى

Hardware and logic / The CPU and the fetch-decode-execute cycle

The central processing unit (CPU) carries out the instructions of a program. Most computers follow the Von Neumann architecture: the program's instructions and its data sit together in main memory, and the processor fetches them one at a time over the same path. Because the instructions are stored in memory like any other data, a computer can run a different program simply by loading different instructions into memory.

Central processing unit

The control unit (CU) directs the processor. It decodes each instruction and sends control signals to the other parts of the computer, telling them what to do and when. The arithmetic and logic unit (ALU) carries out the calculations and the logical comparisons, such as checking whether one value is greater than another.

Inside the CPU are registers, very small stores that hold values the processor is working on. Each one has a particular job:

RegisterWhat it holds
Program counter (PC)The address of the next instruction to fetch
Memory address register (MAR)The address of the memory location being read from or written to
Memory data register (MDR)The data or instruction just read from memory, or about to be written to it
Current instruction register (CIR)The instruction being decoded and executed
Accumulator (ACC)The result of the latest arithmetic or logic operation

The cycle, step by step

Every instruction goes through the same three stages.

  1. Fetch. The address in the PC is copied to the MAR. The instruction stored at that address is copied into the MDR, and from the MDR into the CIR. The PC is then incremented, so it holds the address of the next instruction.
  2. Decode. The control unit works out what the instruction in the CIR asks for: the operation, and where the data it needs is.
  3. Execute. The operation is carried out. Arithmetic and logic go through the ALU, and a result may be placed in the ACC or written back to memory.

The cycle then starts again with the address now in the PC.

A worked trace

Suppose the PC holds 100, memory location 100 holds the instruction LOAD 200, and LOAD copies the value at address 200 into the accumulator. Then:

  • The address 100 is copied from the PC to the MAR.
  • The instruction LOAD 200 is copied from location 100 into the MDR, then into the CIR.
  • The PC is incremented from 100 to 101.
  • The control unit decodes LOAD and finds the address 200.
  • The value at address 200 is copied into the ACC.

After the cycle the PC holds 101, the ACC holds the value from address 200, and the next cycle fetches whatever is at address 101.

Clock speed

The clock sends out regular pulses, and each pulse is a clock cycle. Clock speed is the number of cycles the processor completes each second, measured in hertz. A processor running at 2.5 GHz completes 2.5×1092.5 \times 10^{9} cycles every second.

A cycle does not always mean one instruction, because a single instruction can take several cycles. Suppose, for this example, that an instruction takes 4 cycles. Then the processor finishes 2.5×1094=625,000,000\frac{2.5 \times 10^{9}}{4} = 625{,}000{,}000 instructions each second. A higher clock speed usually means faster running, but the number of cycles each instruction needs matters just as much.

Cache and cores

Reading from main memory is much slower than the processor can work, so the CPU keeps a small, fast store called cache close to it. Cache holds data and instructions that are used often. Cache is usually split into levels. Level 1 (L1) is the smallest and fastest, level 2 (L2) is larger and a little slower, and level 3 (L3) is the largest and slowest of the three. When the CPU finds what it needs in cache, it avoids a slow trip to main memory. A larger cache, with more of the needed data in it, usually makes a processor faster.

A multi-core processor has several cores, each able to run its own fetch-decode-execute cycle. Several tasks, or separate parts of one task, can then run at the same time. More cores do not always mean proportionally faster programs: a task can only be shared between cores if it can be split into parts that do not wait on each other.

و20 أخرى: افتح أياً منها من القائمة أعلاه.

التقييمات

لا توجد مراجعات مكتوبة بعد. أضف هذه الملاحظات إلى مجموعتك، ويمكنك أن تكون أول من يكتب مراجعة.