COA Notes
COA Notes
+---------------------+
| Input Devices |
+---------------------+
|
v
+---------------------+
| CPU |
| - ALU |
| - CU |
| - Registers |
+---------------------+
|
v
+---------------------+ +---------------------+
| Primary Memory (RAM)| <------>| Storage |
+---------------------+ | - HDD |
| | - SSD |
v +---------------------+
+---------------------+
| Motherboard |
| - Chipset |
| - BIOS/UEFI |
+---------------------+
|
v
+---------------------+ +---------------------+
| Output Devices |<------>| Network Interface |
+---------------------+ | - Wired (Ethernet) |
| | - Wireless (Wi-Fi) |
v +---------------------+
+---------------------+
| Power Supply Unit |
+---------------------+
|
v
+---------------------+
| Cooling System |
+---------------------+
|
v
+---------------------+
| Expansion Slots |
| and Cards |
+---------------------+
This basic structure outlines the key components and their interactions within a computer system.
Each part plays a crucial role in ensuring the computer operates efficiently and effectively.
CPU:
The Central Processing Unit (CPU), often referred to as the brain of the computer, is the primary
component that executes instructions and processes data. Here's an in-depth look at the CPU's
structure, components, and functions:
Structure and Components of the CPU
1. Control Unit (CU)
o Function: Directs the operation of the processor. It tells the computer's memory,
arithmetic/logic unit, and input and output devices how to respond to the instructions
that have been sent to the processor.
o Components:
Instruction Register (IR): Holds the current instruction being executed.
Program Counter (PC): Keeps track of the address of the next instruction to be
executed.
2. Arithmetic Logic Unit (ALU)
o Function: Performs all arithmetic and logical operations. This includes basic operations
like addition, subtraction, multiplication, division, and logical operations like AND, OR,
NOT.
o Components:
Arithmetic Unit: Handles arithmetic operations.
Logic Unit: Handles logical operations.
3. Registers
o Function: Small, fast storage locations within the CPU used to hold temporary data and
instructions.
o Types:
General Purpose Registers: Used for various functions by the CPU.
Special Purpose Registers: Specific registers with dedicated tasks, such as the
Program Counter (PC), Stack Pointer (SP), and Status Register (SR).
4. Cache Memory
oFunction: Provides high-speed data storage that the CPU can access more quickly than
the main memory (RAM). There are typically multiple levels of cache (L1, L2, and
sometimes L3).
CPU Operation
The CPU operates by following a cycle called the Fetch-Decode-Execute Cycle. Here’s a
breakdown of each stage:
1. Fetch
o The CPU fetches the next instruction from the main memory (RAM) into the instruction
register (IR).
2. Decode
o The control unit decodes the fetched instruction to determine what action is required.
This involves interpreting the opcode (operation code) and any necessary operands.
3. Execute
o The decoded instruction is then executed by the appropriate part of the CPU. This might
involve performing an arithmetic operation in the ALU, moving data between registers,
or interacting with memory.
Instruction Register,
Instruction Register (IR):
The IR holds the instruction which is just about to be executed. The
instruction from PC is fetched and stored in IR. As soon as the instruction in
placed in IR, the CPU starts executing the instruction and the PC points to
the next instruction to be executed.
Control Word,
Control word is defined as a word whose individual bits represent the various control
signal. The control words related to an instruction that is stored in microprogram
memory. It is a set of micro-instructions in a micro-routine.
In control words, microoperations are specified, they are known as
microinstructions.
Each microinstruction specifies one or more microoperations that are performed.
The Control Word consists of bits, and each bit corresponds to a function or
commands such as Pause, Stop, Enable, Start, Stop, Move, Jog, etc.
Stack Organization,
Stack Organization
The stack can be used for various purposes like procedure call and return, evaluation of arithmetic
expressions discussed later in further sections, storing local variables, etc. Thus, its implementation
depends on the purposes for which it is required.
If the programmer intends to use the stack for various operations, then the instruction set will
include stack operations, such as Push and Pop. Whereas, if the stack is to be used only by the
processor, for purposes such as procedure call and return, then it is not required to include explicit
stack-oriented instructions in the instruction set.
Figure illustrates that irrespective of the use of the stack, some set of memory locations are
reserved to store the stack elements. These locations can either be reserved in terms of processor’s
registers or the physical memory locations as discussed later.
Instruction Format,
1. Memory Reference – Memory reference instructions enable CPU to read/write data in
memory. Includes load (LDR), store (STR), and control transfer. Crucial for program execution, data
manipulation, and communication with peripherals.
These instructions refer to memory address as an operand. The other
operand is always accumulator. Specifies 12-bit address, 3-bit opcode
(other than 111) and 1-bit addressing mode for direct and indirect
addressing.
Example – IR register contains = 0001XXXXXXXXXXXX, i.e. ADD after
fetching and decoding of instruction we find out that it is a memory
reference instruction for ADD operation.
2. Register Reference – .
ALU
The Arithmetic Logic Unit (ALU) performs arithmetic and logical operations on data received
from registers. It's a key component of the CPU, essential for executing computational tasks in
computer systems.
I/O System,
The I/O subsystem of a computer provides an efficient mode
of communication between the central system and the
outside environment. It handles all the input-output
operations of the computer system.
There are three types of peripherals:
1. Input peripherals : Allows user input, from the outside
world to the computer. Example: Keyboard, Mouse etc.
2. Output peripherals: Allows information output, from
the computer to the outside world. Example: Printer,
Monitor etc
3. Input-Output peripherals: Allows both input(from
outised world to computer) as well as, output(from
computer to the outside world). Example: Touch screen
etc.
Bus,
A bus is a communication system that transfers data between components within a computer or
between different computers. It consists of parallel wires or traces that carry binary information,
address signals, control signals, and power between components such as CPU, memory, and peripherals.
Buses are categorized based on their functions, including data bus, address bus, and control bus.
CPU and Memory Program Counter,
There is a register in a PC (program counter) processor that
contains the address of the next instruction to be executed from
memory.
It is a 16-bit register and is also called instruction counter,
instruction pointer, and instruction address register (IAR). PC
(program counter) is a digital counter that is needed to execute
tasks quickly and track the current execution point.
Bus Structure,
The system bus is a pathway composed of cables and connectors used to carry data between a
computer microprocessor and the main memory. The bus provides a communication path for the data
and control signals moving between the major components of the computer system. The system bus
works by combining the functions of the three main buses: namely, the data, address and control buses.
Each of the three buses has its separate characteristics and responsibilities
R1(8-bit)
() Denotes a part of register
R1(0-7)
R1 <- R2
, Specify two micro-operations of Register Transfer
R2 <- R1
P : R2 <- R1
: Denotes conditional operations
if P=1
addressing modes.
Addressing modes define how CPU instructions specify the memory addresses of operands. Common
modes include direct, indirect, register, and immediate, each determining how operands are accessed or
interpreted during instruction execution.
The term addressing modes refers to the way in which the operand of an
instruction is specified. The addressing mode specifies a rule for interpreting
or modifying the address field of the instruction before the operand is
actually executed.
Common types include:
1. Immediate: Operand value is directly encoded within the instruction.
2. Direct: Operand address is specified directly within the instruction.
3. Indirect: Instruction refers to the address of another memory location, which holds the
operand.
4. Register: Operand is located within a register specified in the instruction.
5. Register Indirect- any selected register would include the address of an operand
6. Auto Increment and decrement -The register whose number is included in the
instruction code, contains the address of the operand. Autoincrement Mode = after
operand addressing , the contents of the register is incremented. Decrement Mode =
before operand addressing, the contents of the register is decrement .
7. Indexed: the content of an index register is added to the address part of an instruction to
derive the effective address.
8. Base- In this mode effective address is obtained by adding base register value to
address field value. EA= Base register + Address field value(OPERAND)
9. Relative: In this mode effective address is obtained by adding base register value to
address field value. EA= OPERAND + PC
The control unit fetches internal program instructions from the main memory to the processor
instruction register, and it generates a control signal based on the contents of this register to
supervise the execution of these instructions.
A control unit receives data from the user and translates it into control signals that are
subsequently delivered to the central processor. The processor of the computer then instructs
the associated hardware on what operations to do. Because CPU architecture differs from
manufacturer to manufacturer, the functions performed by a control unit in a computer are
dependent on the CPU type. The following are some examples of devices requiring a control
unit:
+-------------------------+
| Instruction |
| Fetch |
+------------+------------+
|
v
+------------+------------+
| Decode |
| Unit |
+------------+------------+
|
v
+------------+------------+
| Control |
| Signals |
+------------+------------+
|
v
+------------+------------+
| Execution |
| Unit |
+------------+------------+
F1, F2, F3 are the micro-operation fields. They determine micro-operations for
the computer.
CD is the condition for branching. They choose the status bit conditions.
BR is the branch field. It determines the type of branch.
AD is the address field. It includes the address field whose length is 7 bits.
Symbols with their Binary Code for Microinstruction Fields
Name: Code Symbol
001 AC ← AC + DR ADD
010 AC ← 0 CLRAC
011 AC ← AC + 1 INCAC
100 AC ← DR DRTAC
110 AR ← PC PCTAR
111 AC ← AC + DR WRITE
001 AC ← AC + DR SUB
010 AC ← AC ∨ DR OR
011 AC ← AC ∧ DR AND
101 DR ← AC ACTDR
110 DR ← DR + 1 INCDR
001 AC ← AC ⊕ DR XOR
101 PC ← PC + 1 INCPC
110 PC ← AR ARTPC
Condition Field
A condition field includes 2 bits. They are encoded to define four status bit
conditions. As stated in the table, the first condition is always a 1, with CD = 0.
The symbol that can indicate this condition is ‘U’. The table displays the multiple
condition fields and their summary in an easy manner.
Condition Field Symbols and Descriptions
Condition Symbol Comments
11 AC = 0 Z Zero value in AC
As shown in the table, when condition 00 is connected with BR (branch) field, it
results in an unconditional branch operation.
If all the bits in AC are 1, then it is indicated as Z (its binary variable whose
value is 1). The symbols U, I, S, and Z can indicate status bits while writing
microprograms.
Branch Field
The BR (branch) field includes 2 bits. It can be used by connecting with the AD
(address) field. The reason for connecting with the AD field is to select the address
for the next microinstruction. The table illustrates the various branch fields and
their functions
Branch Field Symbols and Descriptions
BR Symbol Comments
CAR←CAR + 1 if condition = 0
CAR←CAR + 1 if condition = 0
The only difference between the two instructions is that when the
microinstruction is saved, the return address is saved in the Subroutine
Register (SBR).
These two operations are dependent on the CD field values. When the status bit
condition of the CD field is defined as 1, the address that is next in order is
transferred to CAR. Else, it gets incremented.
The opcode bits of instruction can be mapped with an address for CAR if
the BR field is 11.
They are present in DR (11 - 14) after instruction is read from memory. The
last two conditions in the BR fields are not dependent on the CD and AD field
values.
microprogram sequencer
the address sequencing capabilities required in a control memory are:
1. Incrementing of the control address register.
2. Unconditional branch or conditional branch, depending on status bit
conditions.
3. A mapping process from the bits of the instruction to an address for
control memory.
4. A facility for subroutine call and return.
5.
Control Memory,
The control memory, also known as the control store or microstore, is a crucial component within a
microprogrammed control unit. It stores microinstructions, which are low-level instructions that control
the operation of the CPU's various components during the execution of machine instructions.
Computer Arithmetic:
Arithmetic instructions in digital computer$ manipulate data to produce re
sults necessary for the solution of computational problems. These
instructions perform arithmetic calculations and are responsible for the bulk
of activity involved in processing data in a computer. The four basic
arithmetic operations are addition, subtraction, multipllcatio"' and division.
From these four bulk operations, it is possible to formulate other arithmetic
functions and solve scientific problems by means of numerical analysis
methods.
Addition and Subtraction,
Addition (subtraction) algorithm: when the signs of A and B are identical
(different), add the two magnitudes and attach the sign of A to the result.
When the signs of A and B are different (identical), compare the
magnitudes and subtract the smaller number from the larger. Choose the
sign of the result to be the same as A if A > B or the complement of the
sign of A if A < B. If the two magnitudes are equal, subtract B from A and
make the sign of the result positive.
The two algorithms are similar except for the sign comparison. The
procedure to be followed for identical signs in the addition algorithm is the
same as for different signs in the subtraction algorithm, and vice versa.
Addition and Subtraction of Signed·Magnitude Numbers
Add Subtract Magnitudes
Operation Magnitudes When A > B When A < B When A = B
(+A ) + (+ B) + (A + B)
(+A ) + ( - B) + (A - B) - (B - A) + (A - B)
( -A ) + (+ B) - (A - B) + (B - A) + (A - B)
( -A ) + ( - B) - (A + B)
( +A ) - (+ B) + (A - B) - (B - A) + (A - B)
( +A ) - ( - B) + (A + B)
( -A ) - (+ B) - (A + B)
( -A ) - ( - B) - (A - B) + (B - A) + (A -
B)
Booths Algorithm,
Steps of the Algorithm
1. Start: Begin the process.
2. Initialize:
o Load the multiplicand into register BR.
o Load the multiplier into register QR.
o Set the sign of the result based on the signs of BR and QR.
o Clear registers AC and the appended bit Qn+1Q_{n+1}Qn+1.
o Set sequence counter SC to the number of bits in the multiplier, n.
3. Inspect Bits:
o Check the two bits QnQ_{n}Qn and Qn+1Q_{n+1}Qn+1.
If Qn+1Qn=10Q_{n+1}Q_{n} = 10Qn+1Qn=10, subtract BR from AC.
If Qn+1Qn=01Q_{n+1}Q_{n} = 01Qn+1Qn=01, add BR to AC.
If Qn+1Qn=00Q_{n+1}Q_{n} = 00Qn+1Qn=00 or Qn+1Qn=11Q_{n+1}Q_{n} =
11Qn+1Qn=11, do nothing.
4. Arithmetic Shift Right (ashr):
o Perform an arithmetic shift right on the combined registers
ACQRQn+1ACQRQ_{n+1}ACQRQn+1.
5. Decrement SC:
o Decrement the sequence counter SC by 1.
o Check if SC is zero.
If SC is not zero, repeat from Step 3.
If SC is zero, proceed to the next step.
6. Output Result:
o The final product is available in registers AC and QR.
7. End: Terminate the process.
Division Operation,
Division of two fixed-point binary numbers in signed-magnitude representa
tion is done with paper and pencil by a process of successive compare,
shift,and subtract operations.
Binary division is simpler than decimal division be- cause the quotient digits
are either 0 or 1 and there is no need to estimate how many times the
dividend or partial remainder fits into the divisor.
The divisor B consists of five bits and the dividend A, of ten bits.
The five most significan tbits of the dividend are compared with the divisor.
Since the 5-bit number is smaller than B, we try again by taking the six
most significant bits of A and compare this number with B. The 6-bit
number is greater than B, so we place a 1 for the quotient bit in the sixth
position above the dividend. The divisor is then shifted once to the right and
subtracted from the dividend. The difference is called a partial remainder
because the division could have stopped here to obtain a quotient of 1 and
a remainder equal to the partial remainder. The process is continued by
comparing a partial remainder with the divisor. If the partial remainder is
greater than or equal to the divisor, the quotient bit is equal to 1 . The
divisor is then shifted right and subtracted from the partial remainder. If the
partial remainder is smaller than the divisor, the quotient bit is 0 and no
subtraction is needed. The divisor is shifted once to the right in any case.
Notethat the result gives both a quotient and a remainder.
Floating Point Arithmetic Operation.
During addition or subtraction, the two floating-point operands are in AC
andm BR . The sum or difference is formed in the AC . The algorithm can
be divided into four consecutive parts:
1. Check for zeros.
2. Align the mantissas.
3. Add or subtract the mantissas.
4. Normalize the result.
Multiplication
The multiplication algorithm can be subdivided into four parts:
1. Check for zeros.
2. Add the exponents.
3. Multiply the mantissas.
4. Normalize the product.
Division
The division algorithm can be subdivided into five parts:
1. Check for zeros.
2. Initialize registers and evaluate the sign.
3. Align the dividend.
4. Subtract the exponents.
5. Divide the mantissas
Design of Arithmetic
A BCD adder is a circuit that adds two BCD digits in parallel and produces
a sum digit also in BCD. A BCD adder must include the correction logic in
its internal construction. To add 0110 to the binary sum, we use a second
4-bit binary adder as shown in Fig. . The two decimal digits, together with
the input-carry, are first added in the top 4-bit binary adder to produce the
binary sum. When the output-carry is equal to 0, nothing is added to the
binary sum. When it is equal to 1, binary 0110 is added to the binary sum
through the bottom 4-bit binary adder. The output-carry generated from the
bottom binary adder may be ignored, since it supplies information already
available in the output-carry terminal.
I/O Organization:
Peripheral
Devices that are under the direct control of the computer are said
to be connected on-line. These devices are designed to read
information into or out of the memory unit upon command from
the CPU and are considered to be part of the total computer
system. Input or output devices attached to the computer are also
called peripherals . Among the most common peripherals are
keyboards, display units, and printers
I/O Interface –
Input-output interface provides a method for transferring
information between internal storage and external I/0 devices.
Peripherals connected to a computer need special communication
links for interfacing them with the central processing unit. The
purpose of the communication link is to resolve the differences
that exist between the central computer and each peripheral.
The major differences are:
1. Peripherals are electromechanical and electromagnetic devices
and their manner of operation is different from the operation of the
CPU and memory, which are electronic devices. Therefore, a
conversion of signal values may be required.
2. The data transfer rate of peripherals is usually slower than the
transfer rate of the CPU, and consequently, a synchronization
mechanism may be needed.
3. Data codes and formats in peripherals differ from the word
format in the CPU and memory.
4. The operating modes of peripherals are different from each
other and each must be controlled so as not to disturb the
operation of other peripherals connected to the CPU.
PCI Bus,
A Peripheral Component Interconnect Bus (PCI bus) connects the CPU and expansion boards
such as modem cards, network cards and sound cards. These expansion boards are normally
plugged into expansion slots on the motherboard.
The PCI local bus is the general standard for a PC expansion bus, having replaced the Video
Electronics Standards Association (VESA) local bus and the Industry Standard Architecture
(ISA) bus. PCI has largely been replaced by USB
SCSI Bus,
SCSI (pronounced SKUH-zee and sometimes colloquially known as "scuzzy"), the Small
Computer System Interface, is a set of American National Standards Institute (ANSI) standard
electronic interfaces that allow personal computers (PCs) to communicate
with peripheral hardware such as disk drives, tape drives, CD
ROM drives, printers and scanners faster and more flexibly than previous parallel data transfer
interfaces.
USB,
Universal Serial Bus, USB (pronounced yoo-es-bee) is a plug-and-play interface that allows a
computer to communicate with peripheral and other devices. USB-connected devices cover a
broad range; anything from keyboards and mice, to music players and flash drives. For more
information on these devices, see our USB devices section.
USB may also be used to send power to certain devices, such as smartphones and tablets, as well
as charge their batteries
Data Transfer:
Data transfer refers to the secure exchange of large files between
systems
There are two methods used for transferring data between computers which
are given below: Serial Transmission and Parallel Transmission.
Serial, Parallel,
Serial Transmission:
In Serial Transmission, data-bit flows from one computer to another
computer in bi-direction. In this transmission, one bit flows at one clock
pulse.
Parallel Transmission:
In Parallel Transmission, many bits are flow together simultaneously from
one computer to another computer. Parallel Transmission is faster than
serial transmission to transmit the bits. Parallel transmission is used for short
distance.
[Link] Serial Transmission Parallel Transmission
Generally, Parallel
Generally, Serial Transmission is used
6. Transmission is used for short
for long-distance.
distance.
[Link] Serial Transmission Parallel Transmission
Synchronous,
HANDSHAKING
Strobe Methods Source-Initiated The source unit that initiates the transfer has no way of
knowing whether the destination unit has actually received data Destination-Initiated The
destination unit that initiates the transfer no way of knowing whether the source has actually
placed the data on the bus To solve this problem, the HANDSHAKE method introduces a second
control signal to provide a Reply to the unit that initiates the transfer
SOURCE-INITIATED TRANSFER USING HANDSHAKE
The daisy-chaining method of establishing priority involves serially connecting all devices requesting an
interrupt, with the highest priority device placed first in the chain, followed by lower-priority devices.
This connection enables interrupt recognition based on a wired logic connection, where a low-level
interrupt signal triggers the interrupt line, prompting the CPU to respond. When no interrupts are
pending, the interrupt line remains in a high-level state. The CPU acknowledges an interrupt request by
enabling the interrupt acknowledge line, which passes through each device in the chain unless blocked
by a higher-priority device with a pending interrupt. Each device communicates its interrupt status and
passes on the acknowledge signal accordingly, ensuring that the device closest to the CPU with the
highest priority receives priority for interrupt handling.
The parallel priority interrupt method utilizes a register where interrupt signals from each device
independently set corresponding bits, establishing priority based on the position of these bits in
the register. Alongside the interrupt register, a mask register controls the status of each interrupt
request, allowing for the disabling of lower-priority interrupts during higher-priority device
servicing and enabling high-priority interrupts to interrupt the CPU during lower-priority device
servicing. The priority logic for a system with four interrupt sources involves an interrupt
register and a mask register, each with the same number of bits. These bits are applied to an
AND gate, along with their corresponding mask bits, to produce inputs for a priority encoder,
ensuring interrupts are recognized only if their corresponding mask bit is set to 1. The priority
encoder generates vector address bits for transfer to the CPU and sets an interrupt status flip-flop
(IST) when an unmasked interrupt occurs. The interrupt enable flip-flop (IEN) provides overall
control over the interrupt system, with its outputs ANDed to produce a common interrupt signal
for the CPU. The interrupt acknowledge (INTACK) signal from the CPU enables the output
register, allowing the placement of the vector address (VAD) into the data bus. The interaction
between the priority interrupt controller and the CPU is facilitated by this setup, ensuring
efficient handling of interrupts based on their priority levels.
[Link]
Direct Memory Access (DMA) is a feature in computer systems that allows certain hardware subsystems
to access the main system memory (RAM) independently of the central processing unit (CPU).
DMA is a method that lets an input/output (I/O) device send or receive data directly to or from the main
memory, bypassing the CPU to speed up memory operations
DMA SIGNALS
1. DMAREQ: Peripheral requests DMA transfer from the DMA controller.
2. DACK: DMA controller acknowledges the peripheral's DMA request.
3. HOLD: DMA controller requests control of the system bus from the CPU.
4. HLDA: CPU acknowledges the DMA controller's bus request and releases the bus.
5. BR: DMA controller requests the bus from the CPU (similar to HOLD).
6. BG: CPU grants control of the bus to the DMA controller (similar to HLDA).
7. INT: DMA controller signals to the CPU that the DMA transfer is complete.
During a typical DMA operation, the sequence of signals is as follows: The peripheral device first asserts
the DMAREQ signal to request a DMA transfer from the DMA controller. The DMA controller then
requests control of the system bus by asserting the HOLD (or BR) signal to the CPU. The CPU
acknowledges this request and releases the bus by asserting the HLDA (or BG) signal. The DMA
controller, upon gaining control of the bus, acknowledges the peripheral's request with the DACK signal.
Once the DMA transfer is complete, the DMA controller signals the CPU by asserting the INT signal.
I/O Processor.
An I/O Processor (IOP) is a specialized processor designed to handle input/output operations, freeing
the main CPU from these tasks and improving overall system efficiency. Here’s a concise explanation of
its key aspects:
An I/O Processor is a dedicated processor that manages data transfer between peripheral devices (such
as disk drives, network cards, and printers) and the main system memory. It performs I/O operations
independently of the CPU.
Functions of an I/O Processor
1. Data Transfer Management: Handles the transfer of data to and from peripheral devices.
2. Offloading CPU: Frees the CPU from I/O processing tasks, allowing it to focus on executing
application and system code.
3. Interrupt Handling: Manages interrupts from I/O devices, ensuring timely processing without
burdening the CPU.
4. Data Formatting: Converts data formats as needed between the peripheral devices and the
main memory.
An I/O Processor significantly enhances system performance by managing I/O tasks independently of the
CPU. This allows the CPU to focus on processing tasks while the IOP efficiently handles data transfer and
communication with peripheral devices.
Each IOP takes care of I/O task keeping CPU free from involvement of I/O transfer.
® IOP has ability to execute I/O instruction which gives it complete control over I/O operation. It has its
own® instruction set with I/O instructions and a local memory in its own right. IOP accesses memory by
cycle stealing.
® CPU directs IOP to execute an I/O programs in memory. The IOP fetches and executes these
instructions® without CPU intervention. IOP interrupts CPU when entire operation has been performed.
The major difference between DMA and IOP is that IOP can fetch and execute I/O instruction from
memory® but DMA cannot fetch and execute the I/O instruction.
Memory Hierarchy
+---------------------+
| Registers |
+---------------------+
|
+---------------------+
| Cache |
+---------------------+
|
+---------------------+
| RAM |
+---------------------+
|
+---------------------+
| Secondary Storage |
+---------------------+
|
Registers: The fastest and smallest memory located within the CPU, used for temporary
storage of data and instructions.
Cache: A high-speed memory located on the CPU, combining multiple levels (L1, L2, L3) to
store frequently accessed data and instructions.
RAM (Random Access Memory): Main system memory that is fast and volatile, used for
active processes and data.
Secondary Storage: Non-volatile storage such as HDDs and SSDs, used for long-term
storage of data and programs.
Memory Organization:
Memory organization refers to how data is stored and accessed within a computer's memory
system. There are several levels of memory organization in a typical computer system:
1. Registers: These are the smallest units of memory and are located within the CPU.
Registers hold data that are currently being processed by the CPU. They have the fastest
access time but are limited in capacity.
2. Cache Memory: Cache memory is a small amount of high-speed static RAM (SRAM)
that is located within or very close to the CPU. Its purpose is to temporarily store
frequently accessed data and instructions to speed up processing. Cache memory is
organized into several levels (L1, L2, L3) based on proximity to the CPU and size, with
L1 being the closest and smallest, and L3 being the farthest and largest.
3. Main Memory (RAM): This is the primary memory in a computer system where data
and programs that are actively being used by the CPU are stored. Main memory is
typically dynamic random-access memory (DRAM) and is organized into memory cells,
each with its own unique address. Accessing data from main memory is slower than
accessing data from cache memory but faster than accessing data from secondary storage
devices.
4. Secondary Storage: This includes devices like hard disk drives (HDDs), solid-state
drives (SSDs), and optical drives. Secondary storage devices have much larger storage
capacities compared to main memory but are slower to access. Data stored in secondary
storage is typically transferred to main memory when it needs to be processed by the
CPU.
5. Virtual Memory: Virtual memory is a memory management technique that uses
secondary storage to simulate additional main memory. When the available physical
memory (RAM) is insufficient to hold all the data and programs that are actively being
used, virtual memory allows the operating system to swap data between RAM and disk
storage as needed.
Memory organization plays a crucial role in the performance of a computer system, with faster
and more efficient access to data and instructions resulting in better overall performance.
Optimizing memory organization involves techniques such as cache management, memory
allocation strategies, and virtual memory management.
Main memory-RAM,
Main memory, also known as RAM (Random Access Memory), is a type of computer memory
that stores data and instructions that are actively being used by the CPU (Central Processing
Unit) or programs running on the computer. RAM is volatile memory, meaning that its contents
are lost when the power is turned off.
Here are some key characteristics of main memory (RAM):
1. Volatile: RAM is volatile memory, which means that its contents are lost when the
power is turned off. This is in contrast to non-volatile memory like hard disk drives
(HDDs) and solid-state drives (SSDs), which retain data even when the power is off.
2. Random Access: RAM is called "random access" because any storage location in RAM
can be accessed directly and in any order, unlike sequential access memory devices like
magnetic tape.
3. Speed: RAM provides fast access to data and instructions compared to secondary storage
devices like HDDs and SSDs. This fast access speed allows the CPU to retrieve and store
data quickly during program execution.
4. Capacity: The capacity of RAM determines how much data and program instructions
can be stored in main memory at any given time. RAM capacities vary widely, ranging
from a few gigabytes (GB) in consumer-grade computers to terabytes (TB) in high-end
servers.
5. Types: There are different types of RAM, including DDR (Double Data Rate), DDR2,
DDR3, DDR4, and DDR5, each offering improvements in speed and efficiency over
previous generations. Other types of RAM include SRAM (Static RAM) and DRAM
(Dynamic RAM).
6. Access Time: RAM typically has much faster access times compared to secondary
storage devices. Access times are measured in nanoseconds (ns) or milliseconds (ms),
with RAM access times typically in the range of nanoseconds.
7. Addressable: Each byte of data in RAM is assigned a unique address, allowing the CPU
to locate and access specific data quickly.
Main memory (RAM) is a critical component of computer systems, and its performance directly
impacts overall system performance. The amount and speed of RAM in a computer system affect
its ability to run multiple programs simultaneously, handle large datasets, and execute tasks
efficiently. Therefore, upgrading RAM is often a cost-effective way to improve the performance
of a computer system.
ROM,
ROM (Read-Only Memory) is a type of non-volatile memory that stores data and instructions
that are permanently written during manufacturing and cannot be easily modified or erased by
normal computer operations. Unlike RAM (Random Access Memory), which is volatile and
loses its contents when power is turned off, ROM retains its data even when power is removed.
Here are some key characteristics of ROM:
1. Non-Volatile: ROM is non-volatile memory, meaning it retains its contents even when
the power is turned off. This characteristic makes ROM suitable for storing essential
system software and firmware that must be preserved between power cycles.
2. Read-Only: The term "read-only" indicates that the data stored in ROM can typically
only be read and accessed; it cannot be easily modified or overwritten by the user or the
computer's operating system. This read-only nature provides stability and security for
critical system software.
3. Permanent Storage: ROM is used to store firmware, BIOS (Basic Input/Output
System), boot loaders, and other essential system software that is necessary for the
computer to start up and operate. These programs are permanently written during
manufacturing and are not intended to be modified during normal use.
Secondary Memory –
Secondary memory, also known as auxiliary memory or external memory, refers to storage
devices that supplement the primary memory (RAM) of a computer system. Unlike primary
memory, which provides fast access to data and instructions but is volatile, secondary memory
offers larger storage capacities and retains data even when the power is turned off. Secondary
memory is essential for storing data and programs that are not actively being used by the CPU
but need to be preserved for future use. Here are some common types of secondary memory:
1. Hard Disk Drives (HDDs): HDDs are one of the most common types of secondary
storage devices. They use magnetic storage to store data on spinning disks called platters.
HDDs offer large storage capacities at relatively low cost but are slower than solid-state
drives (SSDs) in terms of access speed.
2. Solid-State Drives (SSDs): SSDs use flash memory to store data, providing faster access
speeds and better durability compared to HDDs. SSDs are becoming increasingly popular
in both consumer and enterprise environments due to their superior performance, lower
power consumption, and smaller form factor.
3. Flash Drives (USB Drives): Flash drives, also known as USB drives or thumb drives,
are portable storage devices that use flash memory to store data. They are small,
lightweight, and easy to use, making them popular for transferring files between
computers and storing data on the go.
4. Memory Cards: Memory cards, such as Secure Digital (SD) cards and CompactFlash
(CF) cards, are used primarily in digital cameras, smartphones, and other portable devices
to store photos, videos, music, and other data. They offer high storage capacities in a
compact form factor and can be easily inserted and removed from compatible devices.
5. Optical Discs: Optical discs, such as CDs, DVDs, and Blu-ray discs, use laser
technology to store data. They are commonly used for distributing software, movies,
music, and other multimedia content. Optical discs offer relatively large storage
capacities and are read-only (ROM) or read-write (R/W) depending on the type.
Secondary memory plays a crucial role in computer systems by providing long-term storage for
data and programs, enabling users to store large amounts of information and access it as needed.
The choice of secondary memory device depends on factors such as cost, performance, capacity,
and portability, as well as the specific requirements of the application or use case
Magnetic Tape,
Magnetic tape is a form of secondary storage medium that uses a long, narrow strip of plastic
film coated with a magnetic material to store digital data. It is one of the oldest and most
traditional forms of data storage, dating back to the mid-20th century. Magnetic tape is still used
today in various applications where large volumes of data need to be stored economically and
accessed sequentially. Here are some key characteristics of magnetic tape:
1. Storage Capacity: Magnetic tape offers high storage capacities, making it suitable for
archiving and backup purposes. Modern magnetic tape cartridges can store terabytes (TB)
or even petabytes (PB) of data.
2. Sequential Access: Unlike random-access memory (RAM) or solid-state drives (SSDs),
which allow data to be accessed randomly, magnetic tape is a sequential access medium.
This means that data is read or written to the tape in a linear fashion from one end to the
other. Accessing specific data requires fast-forwarding or rewinding the tape to the
appropriate position, which can be time-consuming compared to random access media.
3. Reliability: Magnetic tape is known for its durability and reliability. Unlike optical discs
or flash drives, which can degrade over time or be affected by environmental factors such
as temperature and humidity, magnetic tape is relatively robust and can withstand harsh
conditions.
4. Cost-Effectiveness: Magnetic tape is often more cost-effective than other storage media,
particularly for large-scale data storage. The cost per gigabyte of storage is typically
lower compared to hard disk drives (HDDs) or solid-state drives (SSDs), making
magnetic tape a preferred choice for long-term archival storage of massive datasets.
5. Backup and Archiving: Magnetic tape is commonly used for backup and archival
purposes in enterprise environments, government agencies, research institutions, and
other organizations that need to store large volumes of data securely and cost-effectively.
Tape backups are often stored offsite in secure facilities to protect against data loss due to
disasters such as fires, floods, or cyberattacks.
Disk,
1. Hard Disk Drives (HDDs): Magnetic storage devices with rotating disks coated in
magnetic material, used for long-term storage in computers, with capacities from
gigabytes to terabytes.
2. Solid-State Drives (SSDs): Flash memory-based storage with no moving parts, offering
faster access times, lower power consumption, and greater durability than HDDs, ideal
for high-performance applications.
3. External Hard Drives: Portable storage devices connecting via USB, Thunderbolt, or
other interfaces, containing either HDDs or SSDs, used for backups, file storage, and data
transfer.
4. Optical Discs: Use laser technology for data storage and retrieval, including CDs, DVDs,
and Blu-ray discs, commonly used for software distribution, music, movies, and archival
data.
5. Comparison: HDDs and SSDs are primary internal storage options, with SSDs offering
better performance, while external hard drives and optical discs provide additional or
portable storage solutions.
Optical Storage,
Definition and Technology: Optical storage uses laser technology to read and write data
onto optical discs, which are flat, circular discs made of plastic or glass with a reflective coating.
Types of Optical Discs: Common optical storage media include CDs (700 MB), DVDs (4.7
GB single-layer, 8.5 GB dual-layer), and Blu-ray discs (25 GB single-layer, 50 GB dual-layer).
Data Encoding: Data is encoded as microscopic pits and lands on the disc's surface. A laser
beam reads these reflections as binary data (0s and 1s), allowing for sequential or random access.
Read-Only Discs: Read-only discs, such as CD-ROMs, DVDs, and Blu-ray movies, are pre-
recorded and cannot be modified by the user.
Recordable and Rewritable Discs: Recordable discs (CD-R, DVD-R, BD-R) can be written
to once, while rewritable discs (CD-RW, DVD-RW, BD-RE) can be written to, erased, and
rewritten multiple times.
Cache memory plays a crucial role in improving the overall performance of a computer system
by reducing the average memory access time and minimizing the impact of the slower main
memory. It is an essential component of modern computer architectures and is found in virtually
all CPUs, from desktops and laptops to servers and mobile devices.
Mapping Scheme,
a mapping scheme refers to the method used to determine how data from main memory is
mapped to specific locations in the cache. The mapping scheme governs how cache memory
addresses are translated to main memory addresses and determines how data is retrieved from
and stored in the cache. Common mapping schemes include:
1. Direct Mapping:
In the Direct Mapping using a random-access memory (RAM) for cache, the CPU
address is divided into two fields: the index field (9 bits) and the tag field (6 bits). The
index field determines the cache line to access, while the tag field uniquely identifies the
memory block within the cache line. Both the tag and index bits are used to access main
memory. The number of bits in the index field corresponds to the number of address bits
required to access the cache memory. This approach allows for a simpler cache
implementation using RAM, potentially reducing cost compared to associative memories,
which require additional logic for each cell.
In a direct-mapped cache, each block of main memory is mapped to exactly one specific cache
line. Direct-mapped caches are simple and efficient but may suffer from cache conflicts, where
multiple memory blocks map to the same cache line.
In direct-mapped caches, memory addresses are divided into tags and indexes. Tags uniquely
identify memory blocks stored in cache lines, while indexes determine which cache line to
access based on a modulo function. This efficient mapping scheme allows for quick cache
lookups, ensuring that requested data can be retrieved swiftly when needed.
Set-associative mapping is a cache organization scheme that combines aspects of direct mapping
and fully associative mapping. In set-associative caches, each block of main memory can be
mapped to a set of cache lines, rather than just one line as in direct-mapped caches. These cache
sets typically contain multiple cache lines, allowing for more flexibility in cache management.
Set-associative mapping helps reduce the likelihood of cache conflicts compared to direct
mapping while maintaining relatively low complexity.
In set-associative mapping, multiple cache lines are grouped into sets, and each memory block
can be mapped to a specific set. Within each set, multiple cache lines compete for storing data
from different memory blocks. This allows for multiple tags to be stored within the same index,
offering greater flexibility in caching and reducing the chance of cache conflicts compared to
direct mapping.
Associative Mapping
In associative mapping, the cache is composed of associative memory, which allows any
memory block to be stored in any cache line without restrictions. This means that each cache
line can store data from any memory block, providing maximum flexibility in caching. Associative
memory enables efficient caching by quickly searching for data across all cache lines without the
need for explicit indexing, reducing the likelihood of cache conflicts compared to other mapping
schemes.
Replacement Algorithm,
In set-associative caches, when a miss occurs and the set is full, one of the tag-data items must be
replaced with a new value. The most common replacement algorithms used are:
Random Replacement: The control randomly chooses one tag-data item for
replacement.
First-In, First-Out (FIFO): This procedure selects the item that has been in the set the
longest for replacement.
Least Recently Used (LRU): This algorithm selects the item that has been least recently
used by the CPU for replacement. Implementing FIFO and LRU requires adding a few
extra bits in each cache word to track usage information.
Virtual Memory,
Virtual memory is a crucial concept in modern computer systems that extends the available memory
beyond the physical RAM (Random Access Memory) installed in a computer.
Pages and frames are fundamental concepts in the context of virtual memory and memory
management. Here's an explanation:
1. Pages:
o In virtual memory systems, memory is divided into fixed-size blocks called pages.
These pages are the smallest units of data that can be managed by the virtual
memory system.
Frames:
Frames are the corresponding units of memory in physical memory (RAM) that store the
contents of pages. Like pages, frames are also fixed-size blocks of memory.
Page address translation to frame address involves looking up the page table using the page number
extracted from the virtual address. The page table maps virtual pages to physical frames, providing the
corresponding frame number. This frame number, along with the offset within the page, forms the
physical address. Once computed, the CPU can access the data in the corresponding frame in physical
memory. This process enables programs to interact with a larger virtual address space than physically
available in RAM, facilitating efficient memory utilization and multitasking in virtual memory systems.
In above fig CPU requested page 5 line no: 0101010011 that coverted
into frame no 01 line no: 0101010011
memory management hardware
A memory management unit (MMU) is a computer hardware component that
handles all memory and caching operations associated with the processor. In
other words, the MMU is responsible for all aspects of memory management. It's
usually integrated into the processor, although, in some systems, it occupies a
separate integrated circuit (IC).
What does an MMU do?
The work of the MMU falls into three major categories:
Hardware memory management oversees and regulates the processor's
use of random access memory and cache memory.
OS memory management ensures adequate memory resources are
available for the objects and data structures of each running program.
Application memory management allocates each individual program's
required memory, then recycles freed-up memory space when the operation
concludes.
How does the MMU work?
Next to the central processing unit (CPU), memory is the most important part of a
computer. It's where the work gets done and where instructions and other
computing functions are performed. Memory ensures a computer's utilities work
correctly and applications and input/output functions are performed.
An MMU is an essential part of memory subsystems, keeping all memory-related
functions operating efficiently. Memory management helps with the following
functions:
Memory distribution. The MMU moves memory resources to where they can
best meet system requirements, typically before and after systems processes
are executed.
Monitoring. It tracks all memory resources.
Efficiency. It conserves main memory and other memory resources.
System integrity. It reduces the likelihood of memory fragmentation and poor
memory allocation.
Data integrity. It ensures data integrity is maintained.
Data risk. It minimizes the risk of data corruption.
Cost control. It keeps memory-related costs down
Multiprocessors:
Multiprocessors refer to computer systems with two or more central processing units (CPUs) that share
the same memory and work in tandem to execute tasks. The main goal of multiprocessor systems is to
increase processing power and performance, improve reliability, and allow for better scalability of
computing resources. Here are some key points about multiprocessors:
Types of Multiprocessors
1. Symmetric Multiprocessing (SMP):
2. All processors share a single, common memory space and have equal access to I/O
devices.
3. Each processor runs its own operating system copy and works on its own task.
Asymmetric Multiprocessing (AMP):
A master processor controls the system and assigns tasks to subordinate processors.
Other processors handle specific tasks or perform specific functions and do not share
memory in the same way as in SMP.
Common in real-time systems and embedded systems.
Advantages
1. Increased Performance: By parallelizing tasks, multiprocessors can complete more work in less
time compared to a single processor.
2. Reliability and Fault Tolerance: If one processor fails, others can take over its tasks, ensuring
continued operation.
3. Efficiency in Handling Large Tasks: Suitable for applications requiring substantial computational
power, such as scientific simulations, data analysis, and large-scale transaction processing.
Characteristics of Multiprocessor,
Multiprocessor systems exhibit several key characteristics that distinguish them from single-
processor systems. Here are the main characteristics:
1. Shared Memory
Central Memory: All processors in a multiprocessor system share a common main memory,
allowing them to access and communicate data quickly.
Global Address Space: Each processor can address any memory location directly, facilitating
data sharing and coordination.
2. Interprocessor Communication
Synchronization: Mechanisms like semaphores, locks, and barriers are used to synchronize tasks
and ensure proper sequencing.
Communication: Processors can exchange data either through shared memory or through
explicit message-passing protocols.
3. Load Balancing
Task Distribution: The system dynamically allocates tasks to processors to ensure an even
distribution of the workload.
Dynamic Scheduling: Algorithms are used to assign and reassign tasks in real-time based on
processor load and availability.
4. Scalability
Expandable Architecture: Multiprocessor systems are designed to allow the addition of more
processors to increase computational power.
Performance Scaling: The system can handle increased workloads by adding more processors
without a proportional increase in complexity or performance overhead.
5. Cache Coherence
Consistent Memory View: Mechanisms like MESI (Modified, Exclusive, Shared, Invalid) protocol
ensure that all processors have a consistent view of memory, even if they have their own
caches.
Synchronization Protocols: Protocols are employed to maintain coherence between the caches
of different processors, ensuring data integrity.
6. Resource Sharing
Shared Peripherals: I/O devices, storage, and other peripherals are shared among all processors,
which can lead to contention and necessitate efficient management.
Bus Arbitration: Mechanisms to manage access to the shared bus to prevent conflicts and
ensure fair access to memory and I/O resources.
7. Fault Tolerance
Redundancy: The system can continue functioning even if one or more processors fail,
enhancing reliability.
Error Detection and Recovery: Mechanisms to detect faults and errors and to reassign tasks
from failed processors to operational ones.
8. High Throughput
Parallel Processing: Multiple tasks are processed simultaneously, increasing the overall
throughput of the system.
Concurrency: Support for concurrent execution of processes, leading to better utilization of
processing power.
Concept of Pipelining,
Pipelining is a technique used in computer architecture to increase the throughput of a processor
by overlapping the execution of multiple instructions. It breaks down the execution path of
instructions into discrete stages, allowing multiple instructions to be in different stages of
execution simultaneously. This concept is similar to an assembly line in a factory, where
different stages of production are performed in parallel.
Key Concepts of Pipelining
1. Pipeline Stages
A typical instruction execution is divided into several stages, each performing a part of the
instruction's work. Common stages include:
Fetch (F): Retrieving the instruction from memory.
Decode (D): Interpreting the instruction and preparing the necessary data paths.
Execute (E): Performing the operation specified by the instruction.
Memory (M): Accessing memory for load or store operations.
Write-back (W): Writing the result back to the register file.
Example: 5-Stage Pipeline
Here’s an example of a simple 5-stage pipeline:
1. Instruction Fetch (IF)
2. Instruction Decode (ID)
3. Execution (EX)
4. Memory Access (MEM)
5. Write Back (WB)
Pipeline Diagram
To visualize this, consider the following sequence of instructions and how they flow through a 5-
stage pipeline over time (cycles):
Cycle Instruction 1 Instruction 2 Instruction 3 Instruction 4 Instruction 5
1 IF
2 ID IF
3 EX ID IF
4 MEM EX ID IF
5 WB MEM EX ID IF
6 WB MEM EX ID
7 WB MEM EX
Cycle Instruction 1 Instruction 2 Instruction 3 Instruction 4 Instruction 5
8 WB MEM
9 WB
Each instruction moves to the next stage in each clock cycle, allowing multiple instructions to be
processed simultaneously at different stages.
Vector Processing,
Vector processing is a computing paradigm that enables the processing of entire vectors of data
in a single operation, significantly accelerating performance for specific types of computations. It
is particularly useful in applications involving large datasets and repetitive calculations, such as
scientific computing, engineering simulations, and graphics processing.
Key Concepts of Vector Processing
1. Vector vs. Scalar Processing
Scalar Processing: Traditional CPUs perform operations on single data elements at a time.
Vector Processing: Operations are performed on entire vectors (arrays) of data simultaneously.
This is achieved using special hardware called vector processors.
Array Processing,
Array processing is a computational technique that involves performing operations on entire
arrays of data simultaneously. This approach is highly efficient for tasks that involve large
datasets and repetitive operations, such as matrix computations, image processing, and scientific
simulations. Array processors, also known as SIMD (Single Instruction, Multiple Data)
machines, are designed to exploit data parallelism by applying the same operation to multiple
data points in parallel.
Key Concepts of Array Processing
1. Data Parallelism
Data Parallelism: Involves distributing data across multiple processing elements and performing
the same operation on each data element simultaneously. This is the core principle of array
processing.
2. SIMD Architecture
Single Instruction, Multiple Data (SIMD): A type of parallel computing where a single instruction
operates on multiple data points simultaneously. SIMD is the foundation of array processing.
3. Processing Elements (PEs)
Processing Elements: The individual computational units in an array processor. Each PE
performs the same operation on different pieces of data.
RISC And CISC,
Comparison: RISC vs. CISC
Feature RISC CISC
Instruction Set Small, simple, and fixed-size Large, complex, and variable-size
Instruction
Single-cycle for most instructions Multiple cycles for many instructions
Execution
Memory Access Load/store architecture Instructions can directly access memory
Registers Large number of general-purpose Fewer registers, more memory-based
Feature RISC CISC
registers operations
Optimized for high-performance Complex instructions may take longer to
Performance
pipelining execute
Compiler Design Simplified due to uniform instructions More complex due to varied instruction set
Larger, more instructions for complex Smaller, fewer instructions for complex
Code Size
tasks tasks
Easier to implement and more More challenging due to instruction
Pipelining
efficient complexity