Langsung ke konten

OCR A-Level Computer Science

A-Level · OCRComputer Science45 catatan dalam 8 folder, 256 KB

45 catatan belajar, dibuat oleh cookie, dalam 8 bagian yang mengikuti topik kursus.

Notes for OCR A-Level Computer Science (H446), in folders for the content areas of the two written components in the specification's order: processors and storage, software, exchanging data, data types and structures, ethical and legal issues, computational thinking, programming and algorithms. Code is in OCR-style pseudocode, with Python where it helps. The programming project is not covered. Follows specification version 3.0 (April 2026).

Menambahkannya akan menaruh salinan di catatanmu, dalam folder tersendiri bersama folder di bawahnya. Kamu bisa mengubahnya dan menjadikannya kartu belajar atau deck soal. Mengunduh akan memberimu file zip berisi file markdown yang bisa dibuka di aplikasi catatan apa pun.

Isi di dalamnya

  • Processors and storage
    • The processor and the fetch-decode-execute cycle7 KB
    • CPU performance, pipelining and architectures6 KB
    • Types of processor5 KB
    • Input, output and storage8 KB
  • Software and software development
    • Operating systems and memory management6 KB
    • Interrupts and scheduling7 KB
    • Kinds of operating system, the BIOS, device drivers and virtual machines6 KB
    • Applications, utilities and open and closed source5 KB
    • Translators, compilation, linkers, loaders and libraries6 KB
    • Software development methodologies6 KB
    • Programming paradigms and procedural languages4 KB
    • Assembly language and the Little Man Computer5 KB
    • Modes of addressing memory3 KB
    • Object-oriented programming5 KB
  • Exchanging data
    • Compression4 KB
    • Encryption and hashing5 KB
    • Relational databases and normalisation6 KB
    • SQL5 KB
    • Capturing data, transactions and ACID6 KB
    • Networks, protocols and the internet7 KB
    • Network hardware and models4 KB
    • Network security5 KB
    • HTML, CSS and JavaScript5 KB
    • Search engines, PageRank and client and server side processing6 KB
  • Data types, data structures and Boolean logic
    • Data types and binary integers4 KB
    • Negative numbers and binary arithmetic4 KB
    • Hexadecimal and converting between bases3 KB
    • Floating point numbers6 KB
    • Bitwise manipulation and character sets5 KB
    • Arrays, records, lists and tuples5 KB
    • Linked lists, stacks and queues6 KB
    • Graphs, trees and hash tables6 KB
    • Boolean logic, gates and truth tables4 KB
    • Boolean algebra and simplification4 KB
    • Karnaugh maps4 KB
    • Adders and flip-flops4 KB
  • Legal, moral, cultural and ethical issues
    • Computing legislation7 KB
    • Moral, social and ethical issues9 KB
  • Computational thinking
    • Computational thinking8 KB
  • Problem solving and programming
    • Programming techniques9 KB
    • Computational methods9 KB
  • Algorithms
    • Analysing algorithms and Big O6 KB
    • Algorithms for data structures and tree traversal6 KB
    • Sorting algorithms7 KB
    • Searching and shortest path algorithms8 KB

Catatan pertama

Processors and storage / The processor and the fetch-decode-execute cycle

What the processor does

A processor runs a stored program. The program and the data it works on sit in main memory as binary patterns, and the processor repeatedly takes the next instruction from memory, works out what it means and carries it out. Everything a computer does is built from that one loop, and the parts of the processor are best understood by asking which step of the loop each of them serves.

The arithmetic logic unit, the control unit and the registers

The arithmetic logic unit (ALU) carries out arithmetic (addition, subtraction), logical operations (AND, OR, NOT, XOR), comparisons and bit shifts. It has no idea which instruction it is serving; it is given operands and told which operation to perform, and it returns a result together with some status information, such as whether the result was zero or negative.

The control unit (CU) decodes each instruction and then sends control signals to the other parts of the computer to make it happen: it tells the ALU which operation to perform, tells memory whether to read or write, and routes data along the right paths. It also keeps the steps in time with the clock, a regular electronic pulse that sets the pace of the whole processor.

A register is a tiny store built into the processor itself. It is far faster to reach than main memory, which is why the processor does all its work on values held in registers. Five registers matter in the model of a processor used here.

RegisterHolds
Program counter (PC)The address of the next instruction to be fetched
Memory address register (MAR)The address in memory that is about to be read from or written to
Memory data register (MDR)The data just read from memory, or about to be written to it
Current instruction register (CIR)The instruction that is being decoded and executed
Accumulator (ACC)The working value, and the place where the ALU leaves its results

The MDR is sometimes called the memory buffer register, and the two names mean the same thing. General purpose registers, where they exist, hold other values the program is using.

Buses

A bus is a set of parallel wires that carries signals between components, and each wire carries one bit at a time. There are three.

The address bus carries the address of the memory location or device being accessed. It is one-way, from the processor outwards, because only the processor chooses where to read or write. The number of wires sets how many locations can be addressed: an address bus of nn lines can name 2n2^n locations, so 16 lines address 65 53665\,536 locations and 32 lines address 4 294 967 2964\,294\,967\,296 of them.

The data bus carries the data itself, or the instructions, between the processor, memory and input and output devices. It is two-way, because data goes out to memory on a write and comes in on a read. Its width sets how many bits can be moved at once, so a wider data bus moves more in each transfer.

The control bus carries the control signals from the control unit, such as a memory read, a memory write and the clock signal, and carries signals back to the processor, such as an interrupt request.

The fetch-decode-execute cycle

The processor repeats this cycle for as long as it is running. Register transfer notation describes exactly what moves where; square brackets mean "the contents of the memory location at that address".

Fetch
  1. The address of the next instruction is copied from the PC to the MAR: MAR←PC\text{MAR} \leftarrow \text{PC}.
  2. The PC is incremented so that it points to the following instruction: PC←PC+1\text{PC} \leftarrow \text{PC} + 1.
  3. The address in the MAR is placed on the address bus, a read signal goes out on the control bus, and the contents of that location come back along the data bus into the MDR: MDR←[MAR]\text{MDR} \leftarrow [\text{MAR}].
  4. The contents of the MDR are copied to the CIR: CIR←MDR\text{CIR} \leftarrow \text{MDR}.

The PC is incremented during the fetch, before the instruction has been run. That matters for a branch instruction, which overwrites the PC with a new address and so replaces the value that was just incremented.

Decode

The control unit examines the instruction in the CIR. An instruction is made of an opcode, which says what to do, and usually an operand, which is either a value or the address of a value. The control unit splits the two apart, works out which operation the opcode asks for and sets up the signals needed to perform it.

Execute

The instruction is carried out, and what happens depends on the opcode. The cycle then starts again from the fetch, with the PC already pointing at the next instruction.

For a load instruction the operand is sent to the MAR, the location is read into the MDR and the value moves to the ACC:

MAR←operand,MDR←[MAR],ACC←MDR \text{MAR} \leftarrow \text{operand}, \quad \text{MDR} \leftarrow [\text{MAR}], \quad \text{ACC} \leftarrow \text{MDR}

For an add instruction the same read is made and the ALU adds the value fetched to the ACC, leaving the result in the ACC. For a store instruction the operand goes to the MAR, the ACC is copied to the MDR and the MDR is written to memory. For a branch the operand is copied into the PC, so the next fetch comes from a different place.

A traced example

Suppose memory holds a four-instruction program beginning at address 0 and two data values. In the Little Man Computer instruction set, which is written out in full in its own note, LDA loads, ADD adds, STA stores and HLT stops.

AddressContents
0LDA 4
1ADD 5
2STA 6
3HLT
47
55
60

The registers change as follows, with the PC starting at 0.

StepPCMARMDRCIRACC
Fetch of LDA 410LDA 4LDA 4unchanged
Execute LDA 4147LDA 47
Fetch of ADD 521ADD 5ADD 57
Execute ADD 5255ADD 512
Fetch of STA 632STA 6STA 612
Execute STA 63612STA 612

Location 6 now holds 12, which is the sum of the values at locations 4 and 5.

How the registers relate to assembly language

An assembly language instruction names exactly these operations. An instruction such as LDA is a load into the accumulator and STA a store from it, so a programmer writing assembly is directing the same register transfers described above. Branch instructions write a new value into the PC, which is the only way a program can depart from running in sequence. Because the program counter, the instruction register and the memory registers are part of the processor's own design, they are what differs between one processor family and another, and assembly language is tied to the processor it was written for for that reason.

Dan 44 lagi setelah kamu menambahkannya atau mengunduhnya.

Ulasan

Belum ada ulasan tertulis. Tambahkan catatan ini ke catatanmu dan jadilah yang pertama memberi ulasan.