Topics from the International Baccalaureate (IB) 2014 Computer Science Guide.
SECTION 1 | THE CENTRAL PROCESSING UNIT
The Central Processing Unit, CPU could be recognised as the brains of the computer, this is where most of the calculations and controlling takes place. CPUs work extremely fast and hard, a bi-product of this is that they generate a lot of heat, older CPUs used to sit under a large heat sink with a fan blowing air over the heat sink blades to dissipate the heat, however more modern CPUs no longer require this.
The main components of the CPU are the Arithmetic and Logic Unit, ALU and the registers.
The Arithmetic and Logic Unit is responsible for calculations such as addition, multiplication and logic such as AND and OR. Registers are temporary storage areas used to store small instructions or small pieces of data as it is being processed. Registers are very small and very fast memory situated very close to the ALU. The basic Von Neumann architecture comprises of the following registers.
PC Program Counter
MAR Memory Address Register
MDR Memory Data Register ( Sometimes abbreviated as MBR)
CIR Current Instruction Register
IR Index Register (Sometimes abbreviated as IX)
SR Status Register
PC Program Counter Stores the memory address that holds the next instruction to be read. The incrementor increments/changes the program counter from one instruction to the next and the incrementor is controlled by the clock through the control unit.
MAR Memory Address Register The MAR holds the memory location address that is about to be written or read from
MDR Memory Data Register The MDR, sometimes known as MBR (Memory Buffer Register) holds the data that has just been read, or the data that is about to be stored in a memory location. CIR Current Instruction Register The CIR is used to store the current instruction during the time it is being processed (decoded and executed).
IR Index Register The IR is used to store the value of the current index being accessed. Used when accessing array variable, by indexing the address to be accessed a loop can be used to iterate the value of the index to be accessed. This is illustrated in the assembly language section.
The fetch decode execute cycle The fetch execute cycle is used to describe the flow of data through the processor, how the data is fetched from memory, decoded, a decision on what to do with the data, and then executed, the appropriate action is carried out on the data.
The fetch decode execute sequence 1: The value from the program counter is copied to the MAR 2: A request is made to retrieve the data from the memory location stipulated in the MAR, the request is send via the address bus(one way). 3: The content of the memory location is sent via the Data Bus to the MDR 4: A copy of the MDR is made and placed in the CIR 5: The value of the CIR is decoded (A decision made on what needs to be done with the data). 6: The data is moved to the Acc to be executed 7: A check for interrupts is made 8: The program counter is iterated. Note: The program counter can be iterated at any point after the data is accessed from the memory location, stage 3, however for the purpose of this illustration it is iterated lastly. 9: The loop starts again.
For a video showing the fetch decode execute cycle, click here (HurrayBanana, Published on Oct 11, 2013)
SECTION 2 | PRIMARY STORAGE
Primary storage, also known as main memory, is a type of computer memory that is directly accessible by the CPU (Central Processing Unit). It is used to temporarily store data and instructions that the CPU is currently working on, and provides fast access to frequently used data.
Primary storage typically includes Random Access Memory (RAM) and read-only memory (ROM), which is non-volatile and The size and speed of primary storage can have a significant impact on the performance of a computer system.
SECTION 3 | ROM
ROM (Read-Only Memory) is a type of computer memory that stores data that cannot be changed or overwritten. As the name suggests, data stored in ROM can only be read and accessed, not written to or modified.
ROM is non-volatile, meaning it retains its contents even when the computer is turned off. It is used to store important data that must be preserved, such as firmware, basic input/output system (BIOS) code, and other critical system information.
There are several types of ROM, including Mask ROM, Programmable ROM (PROM), Erasable Programmable ROM (EPROM), and Electrically Erasable Programmable ROM (EEPROM). PROM, EPROM, and EEPROM can be programmed and rewritten using special equipment, but this is not possible with Mask ROM.
Overall, ROM plays a critical role in the proper functioning of a computer system, providing permanent storage of essential data and code that is necessary for the system to operate.
SECTION 4 | RAM
RAM (Random Access Memory) is a type of computer memory that temporarily stores data that the CPU (Central Processing Unit) is actively using. RAM is volatile memory, meaning that its contents are lost when the computer is turned off or restarted.
RAM provides the CPU with quick access to data and instructions that are frequently accessed, improving the overall performance of the computer. When an application is launched or a file is opened, the data is loaded from the hard disk or other storage device into RAM, where it can be accessed much more quickly by the CPU.
The amount of RAM in a computer can have a significant impact on its performance, particularly when running memory-intensive applications such as video editing or gaming software. More RAM allows for more applications to be opened and run simultaneously without slowing down the computer.
There are different types of RAM, including Dynamic RAM (DRAM) and Static RAM (SRAM), with DRAM being the most commonly used type in personal computers. RAM can be upgraded or replaced to increase the amount of available memory in a computer system.
SECTION 5 | RAM VS ROM
A computer needs both RAM and ROM because they serve different purposes in the operation of the system.
ROM (Read-Only Memory) is used to store permanent data and instructions that are required for the computer to start up and operate. This includes firmware, BIOS (Basic Input/Output System) code, and other system information that is essential for the proper functioning of the computer. Because the data stored in ROM cannot be modified, it ensures that this critical information is preserved even when the computer is turned off or restarted.
RAM (Random Access Memory), on the other hand, is used to temporarily store data that the CPU (Central Processing Unit) is actively using. This includes data and instructions for applications that are currently running, as well as data that has been recently accessed and is likely to be needed again in the near future. Because RAM is much faster to access than other types of storage, it allows the CPU to retrieve and process data more quickly, which improves the overall performance of the computer.
ROM provides the computer with essential system information that is required for it to start up and operate, while RAM provides the CPU with quick access to frequently used data and instructions, improving the speed and efficiency of the system. RAM (Random Access Memory) and ROM (Read-Only Memory) are both types of computer memory, but they have several key differences:
Volatility: RAM is volatile memory, meaning that its contents are lost when the computer is turned off or restarted. ROM, on the other hand, is non-volatile memory that retains its contents even when the computer is powered off.
Read/Write Access: RAM is read-write memory, meaning that data can be both read and written to it. ROM is read-only memory, meaning that data can be read from it but not written to it.
Purpose: RAM is used to temporarily store data and instructions that the CPU (Central Processing Unit) is actively using, providing quick access to frequently accessed information. ROM is used to store permanent data and instructions that are required for the computer to start up and operate, providing essential system information.
Types: There are several types of RAM, including DRAM (Dynamic RAM) and SRAM (Static RAM). There are also different types of ROM, including Mask ROM, PROM (Programmable ROM), EPROM (Erasable Programmable ROM), and EEPROM (Electrically Erasable Programmable ROM).
Upgradability: RAM can be upgraded or replaced to increase the amount of available memory in a computer system. ROM is generally not upgradable, as its contents are fixed at the time of manufacture.
Overall, RAM and ROM serve different purposes in the operation of a computer system, with RAM providing temporary storage of frequently accessed data and instructions, and ROM providing permanent storage of essential system information.
SECTION 6 | CACHE MEMORY
In computing, a cache is a small, high-speed memory that stores frequently used data for quick access. The purpose of a cache is to speed up the processing of data by storing it temporarily so that it can be quickly retrieved and used again, instead of having to be fetched from a slower storage device such as a hard drive or main memory.
There are different types of cache memory, including processor cache, disk cache, and web browser cache. Processor cache, also known as CPU cache, is a small amount of memory built into a processor that stores recently processed data for quick access. Disk cache is used to temporarily store data that has been recently read from a hard drive, while web browser cache stores frequently visited web pages and other resources on a user's local machine, allowing them to be quickly loaded the next time they are needed.
In general, the use of cache memory can significantly improve the performance of a computer system by reducing the amount of time it takes to access and process data.
Cache memory uses both a data bus and an address bus because these buses are used to transfer data and instructions between the CPU and the cache memory. The address bus is used to specify the memory location that the CPU wants to access. When the CPU sends a request to the cache memory, it sends the memory address of the data it needs to the cache using the address bus. The cache checks to see if the requested data is already stored in the cache. If the data is in the cache, it can be retrieved quickly and sent back to the CPU using the data bus. The data bus is used to transfer the actual data between the CPU and the cache memory. When the CPU sends a request to the cache memory, the cache retrieves the requested data and sends it back to the CPU using the data bus. The data bus transfers data in parallel, which allows for faster data transfer compared to the serial transfer used by the address bus. The use of both the address bus and the data bus in cache memory allows for efficient and fast data retrieval. By using the address bus to specify the memory location and the data bus to transfer the actual data, the CPU can quickly access frequently used data stored in the cache, which can significantly improve the overall performance of the system.