Computer Basics
Computer Basics
System Bus
Address Bus
The address bus is used to specify the memory addresses where data is stored or
retrieved. When the CPU needs to read from or write to a specific location in memory,
it sends the address of that location via the address bus. The width of the address bus
(measured in bits) determines the maximum amount of memory the system can
address.
Data Bus
The data bus carries the actual data between the CPU, memory, and peripheral
devices. When data is being read from or written to memory, it travels along the data
bus. The width of the data bus (measured in bits) influences the volume of data that
can be transferred at one time. A wider data bus can transfer more data in parallel,
thereby increasing the system's overall data throughput and performance.
Control Bus
The control bus is responsible for carrying control signals that manage and coordinate
the activities of the computer's components. These signals include commands to read
or write data, interrupt signals, and timing signals to synchronize the operations of
different parts of the system. The control bus ensures that all components work in
harmony and follow the correct sequence of operations, enabling the orderly
execution of tasks within the computer.
Von neumann Architecture
The Von Neumann architecture is a basic design for computers that uses the same
memory for both instructions (programs) and data. Created by John von Neumann,
this model involves the CPU fetching instructions from memory one at a time,
decoding, and then executing them. Everything is connected by a single system bus,
which can sometimes slow down the process because the same path is used for both
instructions and data. Despite this, the Von Neumann architecture is the foundation
for most modern computers due to its straightforward and effective design.
Types of memory
Types of RAM:
Types of ROM:
Cache Memory
Cache memory is a small, high-speed memory located close to the CPU that stores
frequently accessed data and instructions. By keeping this critical information readily
available, cache memory significantly reduces the time the CPU takes to access data
from the main memory, thereby speeding up the overall processing. There are
typically multiple levels of cache (L1, L2, and sometimes L3), with L1 being the
fastest and smallest, integrated directly into the CPU chip, and L2 and L3 being larger
but slightly slower.
Secondary memory refers to storage devices that hold data permanently, even when
the computer is powered off. This type of memory includes hard drives, solid-state
drives (SSDs), optical discs, and external storage devices. Secondary memory is used
for storing large amounts of data, software applications, and the operating system.
While it is slower to access compared to primary memory, its non-volatile nature
ensures data persistence and is essential for long-term data retention.
The Control Unit (CU) is a key component of the central processing unit (CPU) in a
computer. Its primary role is to manage and coordinate the operations of the computer
by directing the flow of data between the CPU and other components. The Control
Unit interprets the instructions from the computer’s memory, decodes them, and then
issues signals to execute the instructions using the ALU, registers, and other parts of
the CPU. It ensures that operations occur in the correct sequence and that the CPU
responds properly to inputs and produces the correct outputs. By orchestrating the
activities within the CPU, the Control Unit plays a crucial role in the overall
functionality and performance of the computer.
INPUT/OUTPUT UNIT
The Input/Output (I/O) unit is a vital part of a computer system that manages the
communication between the computer and the external environment. This unit
handles all input operations, where data and instructions are received from input
devices such as keyboards, mice, scanners, and microphones. Similarly, it oversees
output operations, where processed data is sent to output devices such as monitors,
printers, speakers, and external storage devices. The I/O unit ensures data is correctly
transferred to and from the CPU and memory, facilitating the interaction between the
user and the computer. It acts as an intermediary, converting data from a human-
readable format into a machine-readable format for processing and vice versa, thereby
enabling efficient and effective data exchange and peripheral management.
MEMORY HIERARCHY
REGISTERS
Registers are small, high-speed storage locations within the CPU (Central Processing
Unit) that hold data and instructions temporarily during processing. They are the
fastest form of memory in a computer system, designed to store small amounts of data
that the CPU needs to access quickly. Registers play a crucial role in the execution of
instructions, holding operands for arithmetic and logic operations, storing memory
addresses, and buffering data between the CPU and main memory
TYPES
Memory Data Register (MDR):
The Memory Data Register (MDR) is a temporary storage location within the CPU
that holds the data fetched from memory or the data waiting to be written to memory.
Its primary function is to store the actual data that is being transferred to and from the
main memory (RAM). When the CPU needs to read data from memory, it is first
transferred to the MDR before being processed by other parts of the CPU, such as the
ALU (Arithmetic Logic Unit). Similarly, when the CPU writes data to memory, it is
first placed in the MDR before being transferred to the appropriate memory location.
The Memory Buffer Register (MBR), also known as the Memory Buffer or Memory
Data Register (MDR), is a type of register used to store the data being transferred to
and from the computer's primary storage or secondary storage (e.g., RAM, cache
memory, or hard drive).
When the CPU needs to access data from memory, it sends the memory address to the
MAR. The MAR then communicates this address to the memory unit, indicating the
exact location where the data is stored or where it should be stored. This process is
crucial for enabling the CPU to interact effectively with the computer's memory
subsystem, allowing programs to fetch instructions and data as needed during
execution.
ACCUMULATOR
The Accumulator, often abbreviated as ACC, is a special purpose register within the
CPU (Central Processing Unit) of a computer. Its primary function is to temporarily
hold data that is being processed or manipulated during arithmetic or logical
operations. The accumulator plays a central role in the execution of instructions by the
CPU, particularly in simple arithmetic calculations and data manipulation tasks.
The Program Counter (PC), also known as the Instruction Pointer (IP) in some
architectures, is a special-purpose register in a computer's CPU (Central Processing
Unit). Its primary function is to store the memory address of the next instruction to be
fetched and executed.
INSTRUCTION CYCLE
1. Fetch Instruction:
In this stage, the CPU retrieves the instruction it's going to work on. It uses a
special register called the Program Counter (PC) to keep track of the memory
address where the next instruction is located.
The CPU reads the instruction from that memory location and stores it in
another register, typically called the Instruction Register (IR).
Once the instruction is fetched, the PC is incremented to point to the address
of the next instruction in the program. This way, the CPU knows where to
find the following instruction after it finishes the current one.
2. Decode Instruction:
Now that the CPU has the instruction in the IR, it needs to understand what it
means. This stage involves deciphering the instruction.
The instruction typically consists of two parts: an opcode (operation code)
and operands (data to be used in the operation).
The Control Unit (CU) of the CPU interprets the opcode. The opcode specifies
what kind of operation the CPU needs to perform (addition, subtraction, data
transfer, etc.).
The CU may also use the decoder to identify and extract any operands from
the instruction that are required for the operation.
This step might not be necessary for all instructions. It depends on whether
the instruction needs to access data from memory.
Some instructions, like moving data between registers, might have the data
embedded within them. But others, like loading data from memory into a
register, require an additional memory access.
If the instruction needs data from memory, the CPU uses the decoded
information (often the operand) as a memory address. It retrieves the data
from that address and stores it in a temporary register.
4. Execute Instruction:
Finally, with the instruction decoded and any necessary data retrieved, the
CPU carries out the operation specified by the instruction.
The Arithmetic Logic Unit (ALU) is responsible for performing arithmetic and
logical operations like addition, subtraction, comparison, etc.
Other specialized units within the CPU handle different types of instructions,
such as data transfer between registers or memory.
Once the operation is complete, the CPU moves on to the next instruction
and starts the cycle all over again.