Computer Organization and Architecture Main
Computer Organization and Architecture Main
Computer architecture is like the blueprint or and store information. It's like understanding the
design of a computer system. It's all about roles and interactions of the workers in a factory
understanding how the different parts of a to make the whole system function smoothly.
computer work together to perform tasks and
LOGIC GATES
carry out instructions.
Think of a computer as a team of workers in a Logic gates are electronic devices that perform
factory. Each worker has a specific role and basic logical operations on binary inputs to
knows how to perform certain tasks. Similarly, a produce a binary output. They are the
computer has different components that work fundamental building blocks of digital circuits and
together to process information. are essential for the functioning of computers and
other digital systems.
The central processing unit (CPU) is like the
manager of the computer. It's responsible for The primary purpose of logic gates is to process
executing instructions and making decisions. The and manipulate binary information, which is
CPU has different parts, such as the arithmetic represented by 0s and 1s. These binary values
and logic unit (ALU) that performs calculations, correspond to the off and on states of electronic
and the control unit that coordinates and controls signals, respectively. By combining logic gates in
the flow of data. different ways, complex digital circuits can be
created to perform calculations, make decisions,
Memory is like the computer's workspace. It and control the flow of information.
stores information that the CPU needs to work
with. There are different types of memory, like Here are a few reasons why we need logic
random-access memory (RAM) and read-only gates :-
memory (ROM), which have different purposes. 1. Information Processing: Logic gates allow
Input and output devices are like the computer's us to process and manipulate binary
senses. They allow us to interact with the information, which forms the basis of
computer and for the computer to communicate digital computing. By performing logical
with us. Examples include keyboards, mice, operations, such as AND, OR, and NOT,
monitors, and printers. logic gates enable us to perform
calculations, make comparisons, and
The computer also needs a way to store and implement algorithms.
retrieve information for the long term. This is
where storage devices like hard drives or solid- 2. Decision Making: Logic gates help in
state drives (SSDs) come in. They provide a place making decisions based on binary inputs.
for the computer to save data even when it's For example, by using an AND gate, we
turned off. can check if multiple conditions are
satisfied simultaneously. By using an OR
Computer architecture also involves how all these gate, we can determine if at least one
components are connected and how data flows condition is met. These decision-making
between them. This is typically done through capabilities are crucial for various
buses, which are like highways that transfer applications, including computer
information between different parts of the programs, control systems, and data
computer. processing.
In summary, computer architecture is about 3. Data Storage and Memory: Logic gates are
understanding the different parts of a computer, used to build memory units, such as flip-
how they work together, and how they process flops and registers, which can store and
retain binary information. These memory BOOLEAN ALGEBRA
elements are vital for storing data,
instructions, and intermediate results in a Boolean algebra is a mathematical structure that
computer system. deals with binary variables and logical operations.
It provides a formal system for manipulating and
4. Circuit Design and Optimization :- Logic
analyzing logical expressions, which are
gates provide a systematic and modular
statements that can either be true or false.
approach to designing digital circuits. By
combining different types of logic gates, In simpler terms, Boolean algebra helps us
complex circuits can be constructed to understand and manipulate statements that are
perform specific tasks efficiently. either true or false. It allows us to combine these
Additionally, logic gates can be optimized statements using logical operations like AND, OR,
and combined to reduce circuit and NOT, and perform calculations with binary
complexity, power consumption, and values (0s and 1s).
improve overall performance.
Here are some key aspects and applications of
5. Digital Communication: Logic gates are Boolean algebra:
used in digital communication systems to
1. Logical Operations: Boolean algebra
encode and decode data. They help in
defines three fundamental logical
transmitting and receiving binary
operations:
information accurately and reliably over
various communication channels. • AND: Represents the conjunction
of two statements. It evaluates to
In summary, logic gates are necessary because
true only when both statements
they allow us to process, manipulate, and store
are true. For example, "It is
binary information in digital systems. They
raining AND I have an umbrella."
provide the foundation for designing and building
complex digital circuits, enabling the development • OR: Represents the disjunction of
of computers, smartphones, digital appliances, two statements. It evaluates to
and countless other digital devices we rely on in true if at least one of the
our daily lives. statements is true. For example,
"It is raining OR I have an
umbrella."
3. If the data or instructions are found in There are different types of cache memory
the cache, the CPU can retrieve them mapping techniques, but the basic idea is to find
right away. It's like finding the an efficient way to store and find information in
information in the speedy notebook right the cache. The technique used depends on factors
next to you. like simplicity, flexibility, and minimizing
conflicts.
4. However, if the data or instructions are
not found in the cache (called a cache Overall, cache memory mapping is a strategy or
miss), the CPU has to look for them in system used to decide where data or instructions
the main memory. The main memory is should be stored in the cache. It helps the
slower compared to the cache, but it computer find and access the information it needs
holds a lot more data. quickly, improving overall performance.
5. When the CPU successfully finds the data TYPES OF MEMORY MAPPING
or instructions in the cache, it's called a
cache hit. This means the CPU found the ➔ Direct Memory Mapping
information it needed quickly, without ➔ Associative Memory Mapping
➔ Set Associative Memory Mapping
having to search in the slower main
memory.
Think of direct memory mapping like assigning a Think of associative mapping like having a
specific slot or spot in the notebook (cache notebook (cache memory) without any specific
memory) for each piece of information from the spots assigned for information. Each piece of data
main memory. or instruction can be stored anywhere in the
notebook.
Here's how direct memory mapping works :-
When the CPU needs to access data or
1. Each block of data or instructions from
instructions, it searches the entire notebook to
the main memory has only one designated
find the desired information. This flexible
slot in the cache where it can be stored.
mapping technique enables quick retrieval
It's like having a specific place for each
without worrying about specific locations.
piece of information.
In Detail: Associative mapping is a cache memory
2. When the CPU needs to access data or
mapping technique that offers flexibility in storing
instructions, it checks the cache slot that
and retrieving data or instructions. Here's a more
corresponds to the specific location in the
detailed explanation :-
main memory where the desired data or
instructions are stored. 1. In associative mapping, there are no fixed
slots or spots assigned for specific data
3. If the required data or instructions are
blocks in the cache memory. Each block
found in that designated cache slot, it's a
can be stored in any available slot in the
cache hit. The CPU can quickly retrieve
cache.
the information from the cache.
2. When the CPU needs to access data or
4. However, if the data or instructions are
instructions, it searches the entire cache
not found in the designated cache slot,
to find the desired information. It
it's a cache miss. The CPU needs to access
examines all the slots simultaneously,
the main memory to retrieve the
looking for a match.
information.
3. If the required data or instructions are
Direct memory mapping is simple and easy to
found in the cache, it's a cache hit. The
implement because each data block has a specific
CPU can retrieve the information quickly,
location in the cache. However, it may result in
regardless of its location within the cache.
conflicts if multiple data blocks try to occupy the
same cache slot. In such cases, one block may 4. However, if the data or instructions are
need to be replaced with another, causing a not found in the cache, it's a cache miss.
cache miss. The CPU needs to access the main
memory to retrieve the information.
So, direct memory mapping is like having a fixed
spot in the cache for each piece of information. 5. Associative mapping offers flexibility
It simplifies the storage and retrieval process, but because data blocks can be placed in any
conflicts may occur if multiple data blocks need available slot in the cache. This reduces
to occupy the same slot. the likelihood of conflicts when multiple
data blocks try to occupy the same slot.
6. The search process in associative mapping 4. When the CPU needs to access data or
may take longer compared to other instructions, it first checks the specific set
mapping techniques because the CPU related to the memory address. It searches
needs to search the entire cache to find within that set to find the desired
the desired information. information.
Associative mapping is more flexible compared to 5. If the required data or instructions are
direct mapping, but it requires additional search found in the cache set, it's a cache hit.
time to locate the desired data block in the The CPU can retrieve the information
cache. It provides a balance between flexibility quickly from the corresponding set.
and reduced conflicts, as any slot can be used to
6. However, if the data or instructions are
store a data block. However, the flexibility comes
not found in the set, it's a cache miss.
at the cost of longer search times.
The CPU needs to access the main
So, in simpler terms, associative mapping allows memory to retrieve the information.
data or instructions to be stored anywhere in the
Set associative mapping combines the advantages
cache without specific spots assigned. The CPU
of direct mapping and fully associative mapping.
searches the entire cache to find the desired
It offers flexibility within each set while reducing
information, offering flexibility but potentially
the chances of conflicts compared to fully
longer search times.
associative mapping.
3. Within each set, the data blocks can be In Detail :- Virtual memory is a memory
stored in any available slot. This provides management technique used by computers. Here's
flexibility within each set while limiting a more detailed explanation :-
the number of possible locations for a
particular data block.
1. Physical Memory (RAM): memory and the hard disk. Pages
that are not currently needed are
• A computer's physical memory,
moved to the hard disk, freeing
also called RAM (Random Access
up space in the physical memory
Memory), is the actual memory
for other pages.
chips installed in the computer. It
provides fast and temporary
6. Advantages of Virtual Memory:
storage for data and instructions
that the CPU (Central Processing • Allows the computer to run more
Unit) actively uses. programs simultaneously, even if
the physical memory is limited.
2. Memory Address Space: • Provides a larger effective memory
size than the physical memory
• Every program running on a
alone.
computer requires memory to
• Enables the efficient use of
store its instructions and data.
memory resources by swapping
Each program needs its own
pages in and out as needed.
"memory address space" to store
its information. Virtual memory is a crucial technique in modern
computer systems. It allows computers to handle
3. Virtual Memory: larger programs and datasets by using the hard
disk as additional memory. Although the hard
• Virtual memory is an extension of
disk is slower compared to the physical memory,
the computer's physical memory. It
virtual memory helps maintain the illusion of a
uses part of the hard disk space to
larger memory space for the CPU to work with.
simulate additional memory.
• When the physical memory is
insufficient to hold all the SECONDARY MEMORY
programs and data the computer
is running, the operating system Secondary memory, also known as external
uses virtual memory as a memory or storage, refers to the long-term
temporary storage area. storage devices used by computers. It is where
data and programs are stored even when the
4. Page Faults: computer is turned off. Secondary memory
provides larger storage capacities but is slower
• Virtual memory is divided into
compared to the computer's primary memory
fixed-size blocks called "pages."
(RAM).
These pages are stored on the
hard disk. In brief detail: Secondary memory serves as a
• When the CPU needs to access a permanent storage solution for computers. Here's
page that is not currently in the a brief explanation:
physical memory, a "page fault"
1. Long-Term Storage:
occurs. This triggers the operating
system to swap a page from the • Secondary memory is designed to
hard disk into the physical store data and programs for an
memory. extended period, even when the
5. Swapping: computer is powered off.
• It retains information reliably and
• Swapping is the process of moving
does not require a continuous
pages between the physical
power supply.
2. Large Storage Capacities: extended period. It complements the faster but
more volatile primary memory, enabling users to
• Secondary memory devices, such
store and retrieve data beyond the limitations of
as hard disk drives (HDDs) and
the computer's temporary working memory.
solid-state drives (SSDs), provide
much larger storage capacities Devices that provide backup storage are called
compared to primary memory secondary memory or auxiliary memory. These
(RAM). devices store information that is not currently in
• This allows users to store a use by the computer. They have larger storage
significant amount of data, capacities but are slower compared to the
including operating systems, computer's primary memory.
applications, documents, media
Here's a simpler explanation of secondary
files, and more.
memory:
4. Limited Lifespan:
• FLOPPY DISK
• Floppy disks were susceptible to
• HARD DISK damage from dust, heat, and
magnetic fields.
FLOPPY DISK • The magnetic coating could
degrade over time, causing data
Floppy Disk: In Simpler Terms: A floppy disk is a loss.
small, portable storage device that was commonly
used in the past to store and transfer small Hard Disk:
amounts of data. It has a flexible magnetic disk
In Simpler Terms: A hard disk is a primary
inside a protective casing.
storage device in computers that provides a large
In Detail: A floppy disk, also known as a floppy amount of long-term storage. It consists of rigid
or diskette, is a thin, flat storage medium made magnetic disks inside a sealed casing and is used
of a flexible magnetic disk enclosed in a to store the operating system, programs, and user
protective plastic casing. Here are some key data.
points about floppy disks:
In Detail: A hard disk, also known as a hard
1. Data Storage: drive or HDD (Hard Disk Drive), is a non-
• Floppy disks were used to store removable storage device that stores and retrieves
and transfer data, such as digital information. Here are some key points
documents, images, and software, about hard disks:
in the early days of personal 1. Data Storage:
computers.
• Hard disks are used to store
• The magnetic coating on the disk's
various types of data, including
surface stores data as magnetic
the operating system, software
patterns.
applications, documents, photos,
videos, and more.
• Data is stored on rigid, circular OPTICAL DISK
magnetic disks called platters.
4. Installed Internally:
• CODE OPTIMIZATION
3.
• Code optimization is a phase in
the compilation process that aims
to improve the efficiency, speed,
and overall performance of the
generated code. It focuses on
transforming the code to produce
an optimized version while
preserving its original
functionality.written in a linear
order from one end to the other.
• Searching for specific data or
accessing data randomly is more
challenging compared to other
storage devices.
REGISTER TRANSFER AND MICRO In simple terms, a system bus is like a highway
OPERATION that allows different parts of a computer to
communicate with each other. It is a pathway
REGISTERS that enables the transfer of data and control
signals between the CPU, memory, and other
Registers can be thought of as small, ultra-fast
hardware components.
storage units within a computer's central
processing unit (CPU). They are like temporary Here's a brief explanation of a system bus :-
storage spaces where the CPU can quickly access • Think of a system bus as a road that
and work with data or instructions. connects various important locations in a
Here's a closer look at registers :- computer, like the CPU, memory, and
input/output devices.
• Imagine you have a small desk with
drawers right next to you while you're
• It consists of multiple electrical wires or
working on a project. These drawers are
traces that act as communication
your registers.
channels.
• Each register can hold a small amount of
information, such as numbers or
• The system bus carries different types of
instructions.
information, such as instructions, data,
• Registers are built directly into the CPU,
and control signals, between the
making them extremely fast to access.
components.
• The CPU uses registers to store data that
it needs to perform calculations or make
• It allows the CPU to fetch instructions
decisions.
from memory, send and receive data, and
• Instead of retrieving data from the
control the flow of operations.
computer's main memory, which is
slower, the CPU can quickly retrieve data
• The system bus is responsible for
from registers to perform operations.
coordinating and synchronizing the
• Registers are also used to temporarily
activities of different components in the
store intermediate results during
computer.
computations.
• Registers help speed up the overall
• It ensures that data is transferred
performance of the computer by reducing
accurately and in the correct sequence.
the need to access slower memory
locations.
• The width of the system bus, measured in
In summary, registers are like small, lightning- bits, determines how much data can be
fast storage units within the CPU. They allow the transferred at once. A wider bus allows
CPU to quickly access and work with data or for faster data transfer.
instructions, improving the speed and efficiency
of computations. Think of them as handy drawers • The system bus operates at a specific
right next to you while you're working on a clock speed, which defines how fast data
project, providing quick access to the information can be transmitted.
you need.
In summary, a system bus is like a
communication highway in a computer,
connecting the CPU, memory, and other
hardware components. It enables the transfer of data being transferred. The control bus manages
data, instructions, and control signals between operations such as reading or writing data,
these components, ensuring efficient coordination initiating specific actions, or signaling when a
and operation of the computer system. task is complete. It helps ensure that the data is
processed correctly and that the computer
functions smoothly.
TYPES OF SYSTEM BUSES
By understanding the role of each bus, we gain
In a computer system, different components need insight into how data and instructions are
to communicate and exchange information to exchanged within a computer system. The address
perform tasks effectively. The system bus is like a bus guides the CPU to the right location, the
network of interconnected roads that facilitates data bus carries the actual information, and the
this communication. It consists of three main control bus manages and regulates the flow of
buses: the address bus, data bus, and control bus. data and instructions. Together, these buses form
Each bus has a specific role in enabling the flow the backbone of communication and coordination
of information and coordinating the activities of within a computer.
various components. Understanding these buses is
essential to comprehend how data and
REGISTER TRANSFER
instructions are transferred within a computer.
Register transfer refers to the movement of data
Let's explore each of these buses in simpler
between different registers within a computer
terms.
processor or between a register and another
Address Bus :- The address bus is like the road component. In simpler terms, it is like
signs or addresses that help the computer locate transferring information from one storage location
specific information. It is a pathway through to another within the computer.
which the CPU sends signals indicating the
Registers are small, fast storage locations within
memory location or device it wants to
the processor that hold temporary data during the
communicate with. Imagine it as a set of
execution of instructions. They are used to store
directions guiding the CPU to the right
operands (data to be processed) and results of
destination. The address bus allows the CPU to
calculations.
access and interact with the memory or external
devices by specifying the exact location where During register transfer, data is moved from one
data or instructions are stored. register to another through designated paths
within the processor. This transfer can involve
Data Bus :- The data bus is like a busy highway
operations such as copying the contents of one
where information travels between different parts
register to another, adding or subtracting values,
of the computer. It serves as a pathway for
or performing logical operations.
actual data transfer. Just like cars traveling on a
road, data moves through the data bus. It can be Register transfer is an essential part of executing
numbers, text, images, or any other form of instructions in a computer. It allows the processor
information that needs to be processed, stored, or to access and manipulate data quickly, which is
sent to output devices. The data bus ensures that crucial for performing computations and making
data can flow between components like the CPU, decisions.
memory, and input/output devices.
By transferring data between registers, the
Control Bus: Think of the control bus as the processor can perform arithmetic calculations,
traffic signals or commands that regulate the flow logical operations, comparisons, and other tasks
of data and coordinate the activities of different required by the program being executed. Register
computer components. It carries control signals transfer enables efficient data processing and
that instruct the computer on how to handle the
helps ensure that the computer performs tasks handling and reduces the overhead associated
accurately and in a timely manner. with transferring data one unit at a time.
Overall, register transfer is the process of moving Memory transfer is a fundamental operation in
data between registers within the processor, computer systems as it enables the CPU to
enabling the computer to perform computations retrieve instructions and data necessary for
and carry out instructions. It plays a vital role in program execution. It plays a crucial role in the
the efficient functioning of a computer system. overall performance and functionality of a
computer by facilitating the storage and retrieval
BUS AND MEMORY TRANSFER
of data during program execution.
Bus: In the context of computer architecture, a In simpler terms, bus provides a pathway for
bus refers to a communication pathway that different computer components to communicate,
allows different components of a computer system while memory transfer involves the movement of
to exchange data and signals. It is like a highway data between the CPU and the computer's main
that connects various parts of a computer, memory, ensuring that the necessary information
enabling them to communicate and transfer is accessible for processing and execution.
information with each other.
In a computer system, instructions are stored in Instruction formats define the structure and
memory as binary patterns that are recognized organization of instructions in a computer's
and executed by the processor. Each instruction instruction set architecture (ISA). Different
code corresponds to a specific operation or set of instruction formats are designed to accommodate
operations that the processor can carry out. The various types of operands and operations. They
instruction codes are designed to be easily dictate how the instructions are encoded and
interpreted and executed by the processor's decoded by the processor. Here, we will discuss
control unit. four common instruction formats: three-address
instructions, two-address instructions, one-address
An instruction code typically consists of two
instructions, and zero-address instructions.
parts: the opcode and the operand(s). The opcode
specifies the operation to be performed, while the 1. Three-Address Instruction: In a three-
operand(s) provide the necessary data or address address instruction format, an instruction
for the operation. The operands can be registers, can operate on three operands. The
memory locations, or immediate values. instruction typically consists of an opcode
(operation code) and three operand fields,
Different instruction codes have different formats
where each operand represents a memory
depending on the computer architecture. Some
location or a register. This format allows
instruction codes may have fixed lengths, while
for complex operations involving multiple
others may have variable lengths. The format of
operands. Three-address instructions are
the instruction code determines how the opcode
often found in high-level programming
and operands are encoded and interpreted by the
languages and allow for more expressive
processor.
and flexible programming.
Instruction codes are designed to be efficient,
For example, a three-address instruction "ADD X,
compact, and easily decoded by the processor.
Y, Z" adds the values stored in memory locations
They are optimized to minimize the number of
or registers X and Y and stores the result in
instructions required to perform complex
memory location or register Z.
operations and to make efficient use of the
processor's resources, such as registers and 2. Two-Address Instruction: In a two-address
memory. instruction format, an instruction can
operate on two operands. The instruction
The set of instruction codes supported by a
consists of an opcode and two operand
processor is referred to as the instruction set
fields. The first operand represents a
architecture (ISA). The ISA defines the repertoire
source, and the second operand represents
of instructions that a processor can understand
a destination. The result of the operation
is stored in the destination operand. Two- STACK ORGANIZATION
address instructions are commonly used in
many computer architectures and provide In computer architecture, stack organization is a
a balance between flexibility and data structure that follows the Last-In-First-Out
simplicity. (LIFO) principle. It is used for efficient memory
management and control flow in a computer
For example, a two-address instruction "MOV X, system. The stack allows for the dynamic
Y" copies the value from source memory location allocation and deallocation of memory and
or register Y to destination memory location or provides a convenient way to store and retrieve
register X. data.
3. One-Address Instruction: In a one-address 1. Stack Organization: In stack organization,
instruction format, an instruction operates memory is divided into regions called
on only one operand. The instruction stacks. Each stack has a stack pointer that
typically contains an opcode and a single keeps track of the top of the stack. Data
operand field. The operand represents is pushed onto the stack and popped off
either a memory location or a register. the stack using specific instructions or
One-address instructions are less common operations. The stack grows and shrinks
in modern computer architectures but dynamically as data is pushed and
were used in early computer systems. popped.
For example, a one-address instruction "INC X" 2. Register Stack: A register stack is a type
increments the value stored in memory location of stack organization where the stack is
or register X by one. implemented using registers within the
4. Zero-Address Instruction: In a zero-address processor. The registers act as stack
instruction format, an instruction does not locations, and the stack pointer points to
explicitly specify any operands. The the top of the register stack. Register
instruction contains only an opcode, and stacks are commonly used in some
the operands are implicitly determined by processors to store temporary data or
the instruction itself or the processor's function call information. The advantage
internal state. Zero-address instructions of using register stacks is that accessing
are often used in stack-based data from registers is faster than accessing
architectures, where operands are accessed data from memory.
from the top of the stack. 3. Memory Stack: A memory stack, also
For example, a zero-address instruction "ADD" known as a hardware stack or a call
would perform an addition operation on the top stack, is a type of stack organization that
two values on the stack. uses the main memory to store the stack
data. The stack pointer points to the top
Each instruction format has its advantages and is
of the stack in memory, and data is
suited for different types of operations and
pushed and popped from this memory
programming paradigms. The choice of instruction
location. The memory stack is typically
format depends on factors such as the
used for storing local variables, function
architecture's design goals, the complexity of the
call information, and return addresses in
instruction set, and the intended application of
program execution.
the computer system.
The memory stack is commonly used for
managing program execution flow, including
function calls, subroutine jumps, and exception
handling. Each time a function is called or a
subroutine is executed, the necessary information that points to the location where the
is pushed onto the stack, such as the return actual data is stored. When the instruction
address, function arguments, and local variables. is executed, the processor first retrieves
When the function or subroutine completes, the the memory address from the specified
information is popped off the stack, and the location and then retrieves the data from
program execution continues from the return that memory address.
address.
For example, consider an instruction "LOAD A,
The stack organization provides a convenient and (2000)" which loads the value from the memory
efficient way to manage data and control flow in location pointed to by the value stored at
a computer system. It allows for the dynamic memory location 2000 into register A. In this
allocation of memory, supports nested function case, the value at memory location 2000 is a
calls and subroutine execution, and facilitates the pointer or address that indicates the actual
proper handling of program execution flow. Both memory location where the data is stored. The
register stacks and memory stacks play important processor first retrieves the pointer value from
roles in optimizing program performance and memory location 2000 and then retrieves the data
memory management in different computer from the pointed memory address.
architectures.
Indirect addressing allows for more flexible
memory access because it enables the use of
ADDRESSING MODE pointers and dynamic memory locations. It is
often used in cases where the memory address is
Addressing modes determine how the operands of
not known in advance or needs to be dynamically
an instruction are accessed in a computer's
determined during program execution.
memory. Two common addressing modes are
direct addressing and indirect addressing. Both direct and indirect addressing modes have
their own advantages and uses depending on the
1. Direct Addressing: In direct addressing
specific requirements of a program or instruction.
mode, the operand of an instruction is
directly specified by its memory address.
The instruction contains the actual REDUCED INSTRUCTION SET COMPUTER (RISC)
memory address where the data is
RISC instructions, or Reduced Instruction Set
located. When the instruction is executed,
Computer instructions, are the individual
the processor retrieves the data directly
operations that a RISC processor can perform.
from that memory location. Direct
They are designed to be simple and efficient,
addressing is straightforward and efficient
focusing on basic operations that can be executed
for accessing data that is stored at a
quickly by the processor.
known, fixed memory address.
Here are a few key points about RISC
For example, consider an instruction "LOAD A,
instructions:
2000" which loads the value from memory
location 2000 into register A. Here, the memory 1. Simplified instructions: RISC instructions
address 2000 is directly specified in the are designed to be straightforward and
instruction, and the processor retrieves the data easy to execute. They typically perform
from that location. basic arithmetic and logical operations,
such as addition, subtraction,
2. Indirect Addressing: In indirect addressing
multiplication, division, and comparisons.
mode, the operand of an instruction is
not the actual memory address but a 2. Fixed instruction format: RISC instructions
pointer to the memory address. The have a fixed length and follow a
instruction contains a memory address consistent format. This makes them easier
to decode and execute, as the processor load and store instructions to move data
knows in advance the structure and size between memory and the processor's
of each instruction. registers.
1. External Devices:
5. I/O Operations :-
• External devices include various
• I/O operations include reading
peripherals connected to the
data from devices, writing data to
computer, such as keyboards,
devices, and controlling device
mice, displays, printers, scanners,
functions.
and storage devices.
• These operations are coordinated
• These devices allow users to input
by the computer's operating
data (e.g., typing on a keyboard)
system and the software running
and receive output (e.g., viewing
on it.
information on a display).
are called I/O interfaces , and they help bridge mediator, translating the signals
the gap between the computer and each and data formats used by the
In Detail:
• The CPU sends commands to the
I/O device, waits for the device to • DMA is a more efficient technique
complete the operation, and then for transferring large amounts of
transfers data between the device data between the I/O device and
and the computer's memory. memory.
• With DMA, the I/O device takes
• It involves repeatedly checking the control of the system bus and
status of the I/O device, which directly transfers data to or from
can result in slower data transfer the computer's memory without
and high CPU usage. CPU intervention.
• This technique offloads the data
2. Interrupt-Driven I/O: In Simpler Terms: transfer process from the CPU,
Interrupt-driven I/O is a technique where allowing it to focus on other
the I/O device sends a signal to the CPU tasks.
to request attention when it needs to • DMA can significantly improve the
transfer data, reducing the need for speed and efficiency of data
continuous CPU monitoring. transfer, particularly for high-
bandwidth devices like hard drives
In Detail: or network adapters.
• The CPU initiates the I/O In summary, programmed I/O involves the CPU
operation by sending a command directly controlling the I/O operation. The CPU
to the I/O module, specifying requests the operation, the I/O module performs
whether it's a read or write it, and sets status bits to indicate completion. The
operation. CPU periodically checks the status bits to
determine if the operation is finished. No direct
2. I/O module performs the operation: notification or interruption is provided by the I/O
• The I/O module carries out the module to the CPU, so the CPU must actively
requested operation, such as poll the status to determine when the operation
reading data from or writing data is complete.
to an external device.
I/O COMMANDS
3. I/O module sets status bits:
In I/O operations, the CPU issues specific
• After completing the operation, commands to the I/O module to perform desired
the I/O module sets status bits to actions. Here are the four types of I/O
indicate the completion status or commands:
any error conditions.
1. Control Command:
1. CPU initiates the DMA transfer: In summary, DMA provides a solution to the
limitations of interrupt-driven and programmed
• When the CPU wants to read from
I/O by allowing data to be transferred directly
or write to a block of data, it
between an external device and the computer's
sends a command to the DMA
memory without continuous CPU intervention.
module.
The CPU initiates the DMA transfer and provides
• The command includes information
the necessary information, and the DMA module
such as whether to read or write,
takes over the data transfer process, freeing up
the device address, the starting
the CPU for other tasks. The CPU is involved
address of the memory block for
only at the beginning and end of the transfer,
data, and the amount of data to
resulting in improved transfer rates and overall
be transferred.
computer performance.
CHAPTER 8 of tasks, leading to improved performance in
handling complex workloads.
INTRODUCTION TO PARALLEL Parallel processing involves performing tasks
PROCESSING concurrently or executing instructions
simultaneously to increase efficiency and speed.
Techniques like instruction pipelining, where
In traditional computer systems, one way to
different stages of an instruction execution
improve performance is by using multiple
overlap, have been used for a long time to
processors that can work together to handle a
achieve parallelism. Computer designers have
workload. The most common organization for
been exploring more opportunities for parallelism
multiple processors is called symmetric
as technology has advanced and hardware costs
multiprocessors (SMPs). In an SMP system,
have decreased.
several similar processors are present within the
same computer and are connected by a bus or In summary, parallel processing involves using
other switching arrangement. multiple processors to handle work
simultaneously, resulting in improved
SMPs stands for Symmetric Multiprocessors. It
performance. Symmetric multiprocessors (SMPs)
refers to a type of computer system organization
and multiprocessor systems allow for the
where multiple similar processors are present
execution of multiple tasks concurrently. Parallel
within the same computer and are interconnected
processing techniques like instruction pipelining
by a bus or some form of switching arrangement.
have been used to increase efficiency. As
In simpler terms, SMPs are computer systems that computer technology has advanced, designers
have multiple processors working together to have sought more ways to leverage parallelism
handle tasks and workload. These processors are for improved performance.
of the same type and have equal capabilities.
They share access to the computer's memory and
PARALLEL PROCESSING
I/O devices, allowing them to work in parallel
and divide the computational workload among Parallel processing, also known as parallel
themselves. computing, refers to a method of solving
The term "symmetric" in SMPs implies that each problems by using multiple processing elements
processor in the system has equal access to simultaneously. It is based on the idea that large
resources and can perform the same tasks as any problems can be divided into smaller ones and
other processor. They typically have their own solved concurrently (in parallel). Here are some
cache memory, which is a fast and local memory, key points about parallel processing:
allowing for efficient data access. • In a parallel processing system, multiple
SMP systems are designed to improve calculations or tasks are carried out
performance by leveraging parallel processing. By simultaneously, allowing for faster
distributing tasks among multiple processors, they execution time.
can handle larger workloads, execute multiple • The system may have two or more
tasks simultaneously, and achieve better overall Arithmetic Logic Units (ALUs), which are
system performance. responsible for performing calculations,
and can execute two or more instructions
In summary, SMPs are computer systems with
at the same time.
multiple processors that work together in parallel,
• Additionally, the system may have two or
sharing resources and evenly distributing tasks.
more processors working concurrently,
They enable efficient and simultaneous processing
each handling its own set of tasks.
• The main goal of parallel processing is to PIPELINING
increase throughput, which refers to the
amount of processing that can be Pipelining is an implementation technique used to
accomplished within a given time interval. improve the efficiency of executing multiple
instructions in a computer system. It involves
Parallel processing can be classified based on
breaking down a task into smaller sub tasks and
various factors :-
performing them in a sequential manner. Each
• The internal organization of the sub task is handled by a specific functional unit
processors: How the processing elements within the system.
within the system are structured and
Imagine you have a long line of toys that need to
interconnected.
be sorted into different boxes. Instead of doing
• The interconnection structure between
one toy at a time, pipelining allows you to divide
processors: The way processors
the task into smaller steps and work on multiple
communicate and share data with each
toys at once.
other.
• The flow of information through the Here's how it works :-
system: How data and instructions are
1. Step 1: Compare the toys to see which
transferred between processors and
box they should go in.
memory.
2. Step 2: Align the toys in a specific way to
• The number of instructions and data items
make it easier to put them in the boxes.
manipulated simultaneously: How many
3. Step 3: Put the toys in the correct boxes.
calculations or data operations can be
4. Step 4: Make sure the toys are neatly
performed concurrently.
arranged in the boxes.
In parallel processing, there are two important
Instead of doing each step for one toy and then
streams :-
moving on to the next, pipelining allows you to
• Instruction stream :- It refers to the do each step for different toys at the same time.
sequence of instructions that are read So, while you are comparing the first toy,
from memory for execution by the someone else can be aligning the second toy, and
processors. another person can be putting the third toy in
• Data stream :- It refers to the operations the box. This way, the work gets done faster
performed on the data within the because everyone is doing their part
processors. simultaneously.
Parallel processing can occur in the instruction In computer terms, pipelining works similarly. It
stream, the data stream, or both, depending on breaks down tasks into smaller steps and allows
the system design and the nature of the problem different parts of the computer to work on those
being solved. steps simultaneously. This helps computers
process information faster and improves their
In summary, parallel processing is a
overall performance.
computational approach that utilizes multiple
processors or processing elements to solve So, pipelining is like sorting toys into different
problems simultaneously. By dividing tasks into boxes by dividing the task into smaller steps and
smaller parts and executing them concurrently, working on them at the same time to get things
parallel processing aims to achieve faster done faster.
execution times and increase overall processing
In the context of arithmetic operations, such as
capacity.
floating-point addition or multiplication of fixed-
point numbers, pipelining is commonly used in
high-speed computers. Here's an example using In summary, pipelining is a technique used to
floating-point addition and subtraction: enhance the efficiency of executing multiple
instructions or performing arithmetic operations.
Inputs:
It involves dividing a task into smaller subtasks
• X and Y are normalized floating-point and processing them in a sequential manner. In
binary numbers, where X = A x 2^a and the context of arithmetic pipelines, operations
Y = B x 2^b. such as floating-point addition and subtraction
• A and B represent the mantissas are broken down into sub-operations and
(fractions), and a and b represent the performed using different segments. This allows
exponents. for concurrent processing of multiple instructions,
leading to improved performance in high-speed
The pipelined arithmetic unit performs the
computers.
following sub-operations using four segments:
INSTRUCTION PIPELINE
1. Compare the exponents:
• The exponents (a and b) are Imagine you have a set of instructions that you
compared to determine the need to follow in order to build a LEGO
appropriate alignment for the structure. Instead of doing one step at a time,
mantissas. you can use an instruction pipeline to speed up
the process.
2. Align the mantissas:
Here's how it works :-
• The mantissas (A and B) are
1. Step 1: Read the first instruction from the
aligned based on the exponent
instruction booklet.
comparison from the previous
2. Step 2: Understand what the instruction is
step, ensuring that they have the
asking you to do.
same exponent for accurate
3. Step 3: Figure out the specific pieces you
computation.
need and where to find them.
3. Add or subtract the mantissas:
4. Step 4: Retrieve the required LEGO pieces
• The aligned mantissas are added from the storage area.
or subtracted based on the specific 5. Step 5: Perform the action instructed by
arithmetic operation (addition or the step, such as connecting two LEGO
subtraction). pieces together.
4. Normalize the result: 6. Step 6: Put the completed part of the
structure in its designated place.
• The computed result is normalized
to ensure proper representation, Now, with an instruction pipeline, you can have
taking into account any carry or multiple people working on different steps
borrow generated during the simultaneously. For example, while one person is
addition or subtraction. reading the next instruction, another person can
be searching for the required LEGO pieces, and
By breaking down the arithmetic operation into
someone else can be connecting the previous
these sub-operations and processing them in a
pieces together. This way, the process is faster
pipeline, multiple instructions can be overlapped
because each person is focused on their specific
in execution. This overlapping allows for
task.
improved performance and increased throughput,
as each segment can work on different In computer terms, an instruction pipeline works
instructions simultaneously. similarly. Instead of processing one instruction at
a time, the computer can fetch (read) the next
instruction while the previous instructions are
being executed in different stages. Each person can be performing the action of the
instruction goes through the following steps: previous puzzle piece, and someone else can be
fetching the instruction, decoding it to understand retrieving the necessary additional pieces. This
what it means, calculating any necessary way, the puzzle is assembled faster because each
addresses, retrieving operands (data) from person is focused on their specific task.
memory, executing the instruction, and storing
In computer terms, a RISC processor pipeline
the result in the appropriate location.
operates similarly. The processor breaks down
By using an instruction pipeline, computers can instructions into different stages and performs
perform these steps simultaneously for different them simultaneously for different instructions.
instructions, which helps to improve overall The stages include fetching instructions from
processing speed and efficiency. memory, decoding them to understand their
meaning, executing or calculating based on the
So, an instruction pipeline is like following a set
instruction, accessing operands from data
of LEGO instructions with multiple people
memory, and storing the result in registers.
working on different steps at the same time,
making the process faster. In a computer, it RISC instructions are designed to be simpler and
allows the CPU to work on multiple instructions of the same length, making them more suitable
simultaneously, fetching, decoding, executing, and for pipelining. Ideally, each stage in the pipeline
storing results, which helps to speed up the takes one clock cycle, allowing the processor to
overall computation. finish one instruction per clock cycle and achieve
an average of one cycle per instruction.
Now, with a RISC processor pipeline, you can Here's how it works:
have different people working on different puzzle
1. Step 1: Imagine you have a row of
pieces simultaneously. For example, while one
numbers, like [1, 2, 3, 4, 5].
person is fetching the next puzzle piece, another
2. Step 2: Instead of performing calculations
on each number individually, you can
treat the entire row of numbers as a
single entity, like a super number.
3. Step 3: Now you can perform calculations
on this super number, such as adding all
the numbers together in one operation.
4. Step 4: The result will be a new super
number that represents the sum of all the
numbers in the original row.