KEMBAR78
Ch-3. Computer Architecture | PDF | Random Access Memory | Central Processing Unit
0% found this document useful (0 votes)
45 views26 pages

Ch-3. Computer Architecture

The document provides an overview of computer architecture, detailing the functions of the input unit, output unit, central processing unit (CPU), and memory unit. It explains the components of the CPU, including the arithmetic logic unit (ALU), control unit, and registers, as well as the types of memory such as RAM and ROM. Additionally, it discusses cache memory, its importance in processing speed, and the principles of locality of reference.

Uploaded by

quickedindia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views26 pages

Ch-3. Computer Architecture

The document provides an overview of computer architecture, detailing the functions of the input unit, output unit, central processing unit (CPU), and memory unit. It explains the components of the CPU, including the arithmetic logic unit (ALU), control unit, and registers, as well as the types of memory such as RAM and ROM. Additionally, it discusses cache memory, its importance in processing speed, and the principles of locality of reference.

Uploaded by

quickedindia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Page 1

Computer Architecture
Input Unit:
It Performs following functions:
• Accepts instruction and data from
used
• Converts in to computer understandable
form
• Supplies converted data and instruction to
CPU

Output Unit:
It performs following functions:
Page 2

• Accepts results produces by CPU which is in coded form (0,1).


• Converts this coded form to human understandable form.
• Give the converted result to user.

Central Processing Unit:


• Central Processing Unit (CPU) or the processor is also often called the brain of
computer. CPU consists of Arithmetic Logic Unit (ALU), Control Unit (CU)
and Registers.
• Registers are temporary storage areas for holding data, and instructions while
processing.
• CPU is fabricated as a single integrated circuit known as Microprocessor.
• The microprocessor is plugged into the motherboard of the computer
(Motherboard is a circuit board that has electronic circuit printed on it and
connects the microprocessor with the other hardware components).
• The operations a Microprocessor performs are called “instruction set” of this
processor.
• The instruction set is “hard wired” in the CPU and determines the machine
language for the CPU.
• The more complicated the instruction set is, the slower the CPU works.
• Processors differed from one another by the instruction set.
• If the same program can run on two different computer brands they are said to be
compatible.
• Programs written for IBM compatible computers will not run on Apple
computers because these two architectures are not compatible.

Functions of CPU:
• It transfers instructions and input data from main memory to registers.
• Then executes the instruction in stored sequence.
• Then transfers output data from registers to main memory.

Page 3

• CPU controls all the internal and external devices and performs arithmetic and
logic operations.

Arithmetic Logic Unit:


• ALU consists of two units—arithmetic unit and logic unit.
• ALU performs arithmetic and logic operations, and uses registers to hold the
data that is being processed.
Arithmetic Unit
• The arithmetic unit performs arithmetic operations on the data that is made
available to it.
• Some of the arithmetic operations supported by the arithmetic unit are—
addition, subtraction, multiplication and division.
• Arithmetic shift preserves the sign bit (most signi cant bit) when shifting right,
while logical shift always lls the vacated bit positions with zeros, regardless of
the sign.
Logic Unit
• Logic unit performs comparisons of numbers, letters and special characters.
• Logic operations include testing for greater than, less than or equal to condition.
• Performs Bit shifting operations by lling the vacated position by 0.
• Logical Operations like AND, OR, NOT , NOR, XOR etc.

Control Unit:
• The control unit of a computer does not do any actual processing of data.
• It organises the processing of data and instructions.
• It controls and coordinates the activity of the other units of computer.
• CU coordinates the input and output devices of a computer.
fi
fi
fi
Page 4

• It directs the computer to carry out stored program instructions by


communicating with the ALU and the registers.
• CU uses the instructions in the Instruction Register (IR) to decide which circuit
needs to be activated.
• It also instructs the ALU to perform the arithmetic or logic operations.
• To maintain the proper sequence of processing of data the control unit uses Clock
Input.
• CU tells when to fetch the data and instructions, what to do, where to store the
results, the sequencing of events during processing etc.
• CU also holds the CPU’s Instruction Set, which is a list of all operations that
the CPU can perform.

Registers:
• Registers are high-speed storage areas within the CPU, but have the least storage
capacity.
• Registers are not referenced by their address, but are directly accessed and
manipulated by the CPU during instruction execution.
• Registers store data, instructions, addresses and intermediate results of
processing.
• Registers are often referred to as the CPU’s working memory.
• The data and instructions that require processing must be brought in the registers
of CPU before they can be processed. For example, if two numbers are to be
added, both numbers are brought in the registers, added and the result is also
placed in a register.
• Registers are used for different purposes, with each register serving a speci c
purpose.
• Registers are primarily made up of ip- ops, which are electronic circuits
capable of storing a single bit of information.
• A 4-bit register would consist of four ip- ops, each capable of storing one bit of
data.
fl
fl
fl
fl
fi
Page 5

Some of the important registers in CPU are as follows—


• Accumulator (ACC) stores the intermediate results of arithmetic and logic
operations.
• Instruction Register (IR) contains the current instruction most recently
fetched and is just about to be executed. The opcode is the part of the instruction
that speci es the operation to be performed (e.g., add, subtract, load, store)
• Program Counter (PC) contains the address of next instruction to be
processed. It also functions to count the number of instructions.
• Memory Address Register (MAR) contains the address of next location in
the memory to be accessed.
• Memory Buffer Register or Memory Data Register(MBR / MDR) It
contains data to be written into or to be read out from the addressed location in
memory. MAR and MDR together facilitate the communication of the CPU and
the main memory.
• Data Register (DR) stores the operands and any other data.
• Input/Output Address Register: Used to specify the address of an input or
output device.
• Input/Output Buffer Register: Temporarily holds data being transferred to
or from an input/output device.
• Index Register: Used to modify the address of operands during program
execution, particularly useful for array or vector operations.
• General Purpose Registers: These are numbered as R0, R1, R2….Rn-1, and
used to store temporary data during any ongoing operation. Its content can be
accessed by assembly programming. Modern CPU architectures tends to use
more GPR so that register-to-register addressing can be used more, which is
comparatively faster than other addressing modes.
• Stack Pointer (SP): keeps track or points to the top of the stack in memory.
• A stack is a linear data structure that operates on a Last-In, First-Out
(LIFO) principle, where data is added and removed from only one end, called
the "top"
fi
Page 6

• Flag Register: A ag register , also known as a status register or condition


code register, is a special type of register in a computer’s central processing unit
(CPU) used to indicate the status of the CPU or the outcome of various
operations such as Zero Flag, Carry ag, Sign Flag, Over ow Flag, Parity
Flag, Auxiliary Carry Flag, and Interrupt Enable Flag.
• For instance, let’s suppose an operation caused the creation of a negative result
or zero, then these ags are set high accordingly.
These ags are:
Status Flags (Condition Codes):
• Carry Flag (CF): Indicates a carry-out from the most signi cant bit during an
arithmetic operation (addition or subtraction).
• Zero Flag (ZF): Set if the result of an operation is zero.
• Sign Flag (SF): Indicates the sign of the result (1 for negative, 0 for positive).
• Over ow Flag (OF): Set when an arithmetic operation results in a value that
exceeds the representable range (e.g., signed integer over ow).
• Auxiliary Carry Flag (AF): indicates a carry or borrow from the lower nibble
(bits 3-0) to the higher nibble (bits 7-4) during arithmetic operations, primarily
used for Binary-Coded Decimal (BCD) arithmetic.
Control Flags:
• Interrupt Flag (IF): Enables or disables hardware interrupts.
• Direction Flag (DF): Controls the direction of string operations (increment or
decrement).
• System Management Mode (SMM) Flag: Enables or disables the System
Management Mode, a special mode for low-level system operations.
______________________________________________________________________
• The number of registers and the size of each register in a CPU helps to determine
the power and the speed of a CPU.
• The size of register, also called word size, indicates the amount of data with
which the computer can work at any given time. The bigger the size, the more
quickly it can process data.
• The size of a register may be 4, 8, 16, 32 or 64 bits.
fl
fl
fl
fl
fl
fl
fl
fi
Page 7

• 32-bit processor and 64-bit processor are the terms used to refer to the size of the
registers.
• Other factors remaining the same, a 64-bit processor can process the data twice
as fast as one with 32-bit processor.

Memory Unit:
Its function is to hold data and instructions. It consists of:
1. Primary Memory :
A. Volatile Memory (Eg. RAM, Cache Memory)
B. No Volatile Memory ( Eg. ROM, PROM, EPROM, EEPROM)

2. Secondary Memory: ( Eg. Hard Disk, SSD, CD ROM, Pen Drive, Floppy
Disk, DVD)

1. Primary Memory :
Primary memory is the main memory of computer and it can be accessed directly by
the processor.

Random Access Memory


• RAM is a volatile memory, i.e. it loses the data when power is turned off.
• It is a read-write memory which stores the data until the machine is working.
• The information stored in RAM gets erased when the computer is turned off.
• When Computer is turned on the Operating system is loaded from Secondary
storage to RAM.
• All programs, les, and data are stored in secondary storage that is larger and
hence has greater access time. Secondary memory can not be accessed directly by
a CPU, therefore data or instructions are rst loaded in the RAM.
• In order, to execute any process operating system loads the process in primary
memory.
fi
fi
Page 8

Types of RAM:
Dynamic Random Access Memory (DRAM)
• It needs to periodically refresh in a few milliseconds to retain data.
• DRAM is made up of capacitors and transistors and electric charge leaks from
capacitors and DRAM needs to be charged periodically.
• DRAM is widely used in home PCs and servers as it is cheaper than SRAM.
• Advantage: Low manufacturing cost, greater memory capacity
• Disadvantage : Slow access speed, high power consumption.

Static Random Access Memory (SRAM)


• SRAM keeps the data as long as power is supplied to the system.
• SRAM uses Sequential circuits like a ip- op to store a bit and hence need not
be periodically refreshed.
• SRAM is expensive and hence only used where speed is the utmost priority.
• Advantage: Low power consumption, faster access speed.
• Disadvantage: Lower memory capacity, high cost of manufacturing.

Other types of RAM:


Single Data Rate Synchronous Dynamic RAM (SDR SDRAM)
• one read and one write instruction per clock cycle.
• 168 pins and two notches on the connector

Double Data Rate Synchronous Dynamic RAM (DDR SDRAM, DDR2,


DDR3, DDR4):
• operates like SDR SDRAM, only twice as fast.
• two read and two write instructions per clock cycle
• 184 pins and a single notch on the connector
• DDR SDRAM also works at a lower standard voltage (2.5 V - 3.3 V)
fl
fl
Page 9

• DDR2 and DDR3 SDRAM are upgraded version with 240 pins with higher
clock speed and lower power consumption ( 1.8V, 1.5V).
• DDR4 SDRAM uses a 288-pin con guration and 1.2 V.

Graphics Double Data Rate Synchronous Dynamic RAM (GDDR


SDRAM, GDDR2, GDDR3, GDDR4, GDDR5)
• GDDR SDRAM is a type of DDR SDRAM that is speci cally designed for
video graphics rendering, typically in conjunction with a dedicated GPU
(graphics processing unit) on a video card.

ROM (Read only Memory):


• It is a non-volatile memory which, i.e. it does not loses its data which is written
at the time of manufacturing. It is used to store Firmware like BIOS.
• ROM includes those programs which run on booting of the system (known
as a bootstrap program that initialises OS) along with data like algorithm
required by OS.

Types of ROM:
ROM can be broadly classi ed into 4 types based on their behaviour:
• MROM: Masked ROM is hardwired and pre-programmed ROM. Any
content that is once written cannot be altered anyhow.
• PROM: Programmable ROM can be modi ed once by the user. The user buys
a blank PROM and writes the desired content but once written content cannot
be altered.
• EPROM: Erasable and Programmable ROM Content can be changed by
erasing the initial content which can be done by exposing EPROM to UV
radiation. This exposure to ultra-violet light dissipates the charge on ROM and
content can be rewritten on it. These were widely used as BIOS (Basic Input
Output System) chips on motherboard.
fi
fi
fi
fi
Page 10

• EEPROM: Electrically Erasable and Programmable ROM Content can be


changed by erasing the initial content which could be easily erased
electrically(12V or higher). However, one byte can be erased at a time instead of
deleting in one go. Hence, reprogramming of EEPROM is a slow process.

Cache Memory
• The data and instructions that are required during the processing of data are
brought from the secondary storage devices and stored in the RAM. For
processing, it is required that the data and instructions are accessed from the RAM
and stored in the registers. The time taken to move the data between RAM and
CPU registers is large. This affects the speed of processing of computer, and
results in decreasing the performance of CPU.
• Cache memory is a very high speed memory placed in between RAM and CPU
which increases the speed of processing.
• Cache memory is a storage buffer that stores the data that is used more often,
temporarily, and makes them available to CPU at a fast rate.
• During processing, CPU rst checks cache for the required data. If data is not
found in cache, then it looks in the RAM for data.
• To access the cache memory, CPU does not have to use the motherboard’s system
bus for data transfer.
• Cache memory is built into the processor, and may also be located next to it on a
separate chip between the CPU and RAM.
• Cache built into the CPU is faster than separate cache.
• The CPU has a built-in Level 1 (L1) cache and Level2 (L2) cache.
• In addition to the built-in L1 and L2 cache, some CPUs have a separate cache chip
on the motherboard. This cache on the motherboard is called Level 3 (L3) cache.
• Nowadays, high-end processor comes with built-in L3 cache, like in Intel core i7.
fi
Page 11

• The L1, L2 and L3 cache store the most recently run instructions, the next ones
and the possible ones, respectively.
• Typically, CPUs have cache size varying from 256KB (L1), 6 MB (L2), to 12MB
(L3) cache.
• Cache memory is very expensive, so it is smaller in size.
• Generally, computers have cache memory of sizes 256 KB to 2 MB.

Working Principle:
It works on the principle of Locality of Reference i.e. the tendency of processor to
access the same memory locations repetitively over a short period of time. It Stores
data from some frequently used addresses of main memory.

Types of Locality:
1. Temporal Locality: Data that has been recently accessed is likely to be
accessed again soon.
2. Spatial Locality: Data located near each other in memory is likely to be
accessed together.

• Cache hit: Data found in cache. Results in data transfer at maximum speed.
• Cache miss: Data not found in cache. Processor loads data from RAM and
copies into cache. This results in extra delay, called miss penalty.

• Hit ratio = Percentage of memory accesses satis ed by the cache.


• Miss ratio = 1 - hit ratio

Cache Line/Block:
Cache is partitioned into lines also called blocks. Each line has 4-64 bytes in it.
During data transfer, a whole line is read or written. Each line has a tag that indicates
the address in RAM from which the line has been coped.
fi
Page 12

Types of Cache:
1. Fully Associative Cache:
In a cache with complete associativity, any memory
address may be stored in just about any cache line. This
memory type considerably reduces the number of
cache-line misses and is considered a complicated
implementation of cache memory.

2. Direct-Mapped Cache:
A given memory block can be mapped into one and only cache line.

3. Set Associative Cache:


Each Memory Block can be mapped into any one
of the set of Cache Blocks. The number of Cache
Blocks in each set are prede ned Eg. 2,3,4 etc.

Writing into the Cache:

Case-1 (Write Hit)


fi
Page 13

• Write through:
Data is written to both the cache and main
memory at the same time.

• Write through:
Initially, writing is done only to the cache. The write to the RAM is postponed
until the modi ed content is about to be replaced by another cache block.

Case-2 (Write Miss)


• Write allocate (also called fetch on write):
Data at the missed-write location is loaded to cache, followed by a write-hit
operation. In this approach, write misses are similar to read misses.
• No-write allocate (also called write-no-allocate or write around):
Data at the missed-write location is not loaded to cache, and is written directly to
the RAM. In this approach, data is loaded into the cache on read misses only.

Uni ed vs Split Cache


• Uni ed Cache:
In uni ed cache, code and data are located in the same cache and the portion of
cache taken by both code and data can vary accordingly to the situation. So, all
the fetch or load requests of both code and data come to the same cache. In
uni ed cache we only need to design and handle one cache.

• Split Cache:
In split cache, code and data are placed separately on two different cache
portions. In this cache, the size of code and data portion is not exible and can
not be changed according to the situation. In this cache, all the load requests of
data come to data cache portion and all the fetch requests of the code come to
code cache portion. It is very effective pipe-lining. This is also known as I&D
cache.
fi
fi
fi
fi
fi
fl
Page 14

Cache controller
Cache controller handles the data requests and controls data transfer between Cache
and Processor & Cache and Memory. When processor requests a data element, cache
controller checks for that element in Cache, and provides it to processor if present. In
case, the required data element is not present in cache, the cache controller requests
that data from memory. The read and write requests to memory are handled by the
memory controller.

• CPU Cache that stores executable instruction is called i-cache.


• CPU cache that stores data is called D-Cache.

2. Secondary Memory:
• It is a non-volatile memory which is also called Auxiliary Memory.
• CPU cannot access the data directly from the secondary memory.
• Data is rst loaded in primary memory and then accessed by CPU.
• There are 3 main types of Secondary Storage:
1. Flash Memory (SSD’s):
• SSDs use Flash Technology i.e. NAND Flash, which is a non-volatile ash
memory.
• These ash chips use Floating Gate Transistors to store 1 bit of data.
• Eg. USB drives (Pen Drives), Memory Cards (SD-Secure Digital, Micro
SD), Solid-State Drives (SSDs), Smartphones, tablets, BIOS Chips.
fl
fi
fl
Page 15

• eMMC (Embedded Multi Media Card) is a type of ash memory that is


embedded directly into a device, often used in smartphones, tablets, and
other embedded systems

2. Optical Storage Devices:


• Optical devices use a laser to scan the surface of a spinning disc made of
metal and plastic.
• The Disk surface is divided into tracks.
• Each track has some at areas called lands and hollow areas called pits.
• When the laser beam hits a pit, it scatters, while when it hits a land, it
re ects more strongly.
• A sensor in the optical drive detects the variations in the re ected light
intensity, converting them into electrical signals that represent the data(0,1).
Examples:
• CD-ROM: A compact disc-read only memory (CD-ROM) is a pre-
recorded disc that contains data or software that cannot be altered or erased.
CD-ROMs are typically mass-produced and distributed for commercial use.
It has standard storage capacity of 640 MB.
• CD-R (Compact Disc-Recordable): It uses WORM (Write Once
Read Many) technology. It is a variation of CD-ROM, which is a blank disc
that can be written on once, but after that you cannot change its data.
• CD-RW(Compact Disc-Rewritable): Data can be written and erased
multiple times.
• DVD(Digital Versatile Disc or Digital Video Disc): Invented by
Sony DADC(Digital Audio Disc Corporation) in 1996 in Japan. Single
layer DVD can store 4.7 GB of data and dual layer DVD can store 8.5 GB.
• Holographic Versatile Disc (HVD) is an optical disc technology that
was expected to store up to several terabytes of data on an optical disc 10 cm
or 12 cm in . Its development commenced in April 2004. The technology
was abandoned due to funding issues.
fl
fl
fl
fl
Page 16

• Blu-ray Disc: is an optical disc format like CD and DVD. Blu-ray discs
can hold more information than other optical media, because of the blue
lasers that the disc drives use. A single Blu-ray disc can hold up to 25GB to
50GB of data.

3. Magnetic Storage Devices:


• Magnetic storage devices utilise a magnetisable material, such as a thin lm
of iron oxide or ferrite, coated on a disk (in HDDs) or a tape.
• Data is stored by magnetising speci c areas (Segments of concentric circles)
of this material, creating patterns of magnetic domains that represent 0s and
1s.
• A read/write head, which is a small electromagnet, is used to write
(magnetise) and read (detect the magnetisation) data on the magnetic
surface.
Examples:
• Hard Disk Drives (HDDs): In HDDs, the magnetic material is a
spinning disk (platter) coated with a thin layer of magnetic material.
• Magnetic Tapes: In magnetic tapes, the magnetic material is a long strip of
plastic coated with a magnetisable layer.
• Floppy Disc: A oppy disk is a thin, exible disk coated with a magnetic
material, sealed within a plastic carrier. It is a type of removable magnetic
storage medium used in 1980s to distribute softwares, transfer les and back
up data. Standard sizes: 3.5mm(1.44MB), 5.25mm(1.2MB), 8mm(80-240
KB).
• Zip Disc: It is the advanced version of Floppy Disc. It was developed by
Iomega. These are available in 100MB, 250MB, 750MB.
• Magnetic Stripes: These are found on credit cards, ID cards, and other
devices, storing data using magnetic patterns.
______________________________________________________________________
fl
fi
fl
fi
fi
Page 17

BIOS(Basic Input/Output System):


• It is a built in software that contains the code required to control the various
devices connected to main computer.
• BIOS is a type of rmware, meaning it's software embedded in hardware
(speci cally, a memory chip on the motherboard).
• It is stored on a small memory chip, speci cally a type of ROM (Read-Only
Memory) or ash memory, located on the computer's motherboard.
• The BIOS also contains drivers, which are small programs that allow the
operating system to interact with the hardware i.e. Monitor, keyboard, Mouse,
storage controllers Etc. but not all drivers are stored in BIOS.
• It works as inter-mediatory between CPU and I/O devices.
• When you power on your computer, the BIOS is the rst software that executes.

Key Functions:
• The BIOS performs a series of diagnostic tests to ensure that the hardware
components are functioning correctly before the operating system is loaded.
• This is called POST (Power On Self Test)
• The BIOS initialises and con gures the computer's hardware, including the
CPU, memory, storage devices, and peripherals.
• After POST, the BIOS locates and loads the bootstrap loader, which is a small
program that initiates the operating system.
• Then Bootstrap Loader loads the Operating System into RAM.
• The BIOS also provides access to a setup utility (often accessed by pressing a keys
like F2 or DEL during startup) where users can con gure hardware settings, such
as boot order, set Boot drives, enable or disable system components.

Booting:
• Booting is the process of starting a computer, or restarting it i.e the sequence of
loading the OS to main memory.
fi
fl
fi
fi
fi
fi
fi
Page 18

• Sequence: Activate BIOS > Perform POST > Invoke Bootstrap Loader > Load
O.S. > Check con guration setting
Cold Booting:
• A cold boot starts a computer from a completely powered-off state.
• Requires the computer to initialise all hardware and software components from
scratch.
• It is initiated by pressing power button and takes longer than Warm Boot.

Warm Booting:
• A warm boot restarts a computer without fully powering it off.
• The computer's hardware remains powered on while the operating system is
reloaded.
• Faster than colder boot and is initiated by restart command or shortcuts like
Ctrl+Alt+ Del.

CMOS Chip:
• CMOS (Complimentary Metal Oxide Semiconductor) Chip is a kind of memory
technology present on motherboard .
• It is powered by a small battery.
• It stores information like system date, time, boot order, essential system settings.
fi
Page 19

MMU(Memory Management Unit):


• It s a computer Hardware component that translates virtual addresses used by
software into physical addresses used by the memory system.
• It does:
• Hardware Memory Management, i.e RAM and Cache.
• O.S. Memory Management.
• Application Memory Management.

Paging:
• Paging is a storage mechanism used in OS to retrieve processes from secondary
storage to the main memory as pages.
• The primary concept behind paging is to break each process into individual pages.
Thus the primary memory would also be separated into frames.
• One page of the process must be saved in one of
the given memory frames.
• Process pages are usually only brought into the
main memory when they are needed; else, they
are stored in the secondary storage.
• The frame sizes may vary depending on the
OS.
• Each frame must be of the same size.
• “frames" are physical units of main memory used by the computer's hardware.
• A process's logical memory is divided into equally sized blocks called "pages," .
• Paging is a process of loading small pages of a process into frames (hardware
memory blocks).
• It is used in active processes.
Features:
Page 20

Memory Management:
Paging is a fundamental part of how operating systems manage memory, enabling
processes to run even when there isn't enough physical memory (RAM) available to
hold them all at once.

Fixed-Size Blocks:
Both physical memory (frames) and logical memory (pages) are divided into
equal-sized blocks, which simpli es memory allocation and deallocation.

Non-contiguous Allocation:
Paging allows processes to reside in non-contiguous memory locations, meaning
that the pages of a process don't have to be stored next to each other in physical
memory.

Page Table:
It is a data structure used by virtual memory system to map virtual addresses into
physical addresses.

Demand Paging:
• It means keeping those pages of the process in RAM, that are required.
• When referred page is not available in RAM, it is called Page Fault.
• Due to high page fault CPU need to read data from secondary memory, which is
called thrashing.

Causes of Thrashing:
• Insuf cient RAM: If the physical memory is too small to hold all the active pages
of the running processes, thrashing can occur.
• Poor Memory Management: If the OS is not ef ciently managing memory
allocation and swapping, it can lead to thrashing.
• Too many processes: If there are too many processes running simultaneously,
each requiring a large amount of memory, thrashing can occur.
fi
fi
fi
Page 21

Solutions to prevent Thrashing:


• Increase RAM, Optimise Memory Management, Reduce Multiprogramming.

Swapping:
When a process needs more memory than is currently available, the operating
system can swap pages out to secondary storage (like a hard drive) and swap pages
back in from secondary storage as needed.

Virtual Memory:
Paging is a key component of virtual memory, which allows a computer to run
programs that are larger than the available physical memory(RAM). This extra space
created due to swapping with secondary memory is called virtual memory.

TLB (Translational Lookaside Buffer)


• It is also a kind of cache used between CPU and RAM.
• It is only required only if virtual memory is used by CPU.
• It is used by Memory Management Unit (MMU) to translate logical addresses to
physical addresses.
• It stores translated addresses.
Logical Memory: is the memory space a program perceives. Programs are logical
addresses generated by CPU.

Physical memory: actual location is the RAM is called Physical Memory.

• This address generated by CPU for the process is called Logical Address.
______________________________________________________________________
Page 22

Microprocessor
Instruction Set:
• CPU has built-in ability to execute a particular set of machine instructions, called
its instruction set.
• The instructions in the instruction set are the language that a processor
understands.
• All programs have to communicate with the processor using these instructions.
• An instruction in the instruction set involves a series of logical operations (may be
thousands) that are performed to complete each task.
• The instruction set is embedded in the processor (hardwired), which determines
the machine language for the processor.
• All programs written in a high-level language are compiled and translated into
machine code before execution, which is understood by the processor for which
the program has been coded.
• Most CPUs have 200 or more instructions (such as add, subtract, compare, store
etc.) in their instruction set.
• CPUs made by different manufacturers have different instruction sets.
• Manufacturers tend to group their CPUs into “families” having similar instruction
sets.
• New CPU whose instruction set includes instruction set of its predecessor CPU is
said to be backward compatible with its predecessor.
• Two processors are different if they have different instruction sets.
• A program run on one computer may not run on another computer having a
different processor.
• Two processors are compatible if the same machine level program can run on both
the processors.
Page 23

INSTRUCTION CYCLE
The primary responsibility of a computer processor is to execute a sequential set of
instructions that constitute a program.
CPU executes each instruction in a series of steps, called instruction cycle.
An instruction cycle involves four steps:
• Fetching: The processor fetches the instruction from the memory. The fetched
instruction is placed in the Instruction Register. Program Counter holds the
address of next instruction to be fetched and is incremented after each fetch.
• Decoding: The instruction that is fetched is broken down into parts or decoded.
The instruction is translated into commands so that they correspond to those in the
CPU’s instruction set. The instruction set architecture of the CPU de nes the way
in which an instruction is decoded.
• Executing: The decoded instruction or the command is executed. CPU performs
the operation implied by the program instruction. For example, if it is an ADD
instruction, addition is performed.
• Storing: CPU writes back the results of execution, to the computer’s memory.

Microarchitecture:
• Microarchitecture is the processor design technique used for implementing the
Instruction Set.
• Computers having different microarchitecture can have a common Instruction Set.
• Pentium and Athlon CPU chips implement the x86 instruction set, but have
different internal designs.
Instructions are of different categories. Eg.
• Memory access or transfer of data between registers.
• Arithmetic operations like addition and subtraction.
• Logic operations such as AND, OR and NOT.
• Control the sequence, conditional connections, etc.
fi
Page 24

Processor Speed:
➡A CPU performance is measured by the number of instructions it executes in a
second, i.e., MIPS (million instructions per second), or BIPS (billion instructions
per second).

➡Computer has a built-in system clock that emits millions of regularly spaced electric
pulses per second (known as clock cycles)
✓It takes one cycle to perform a basic operation.
✓Normally, several clock cycles are required to fetch, decode, and execute a single
program instruction.
✓Hence, shorter the clock cycle, faster the processor
✓Clock speed (number of clock cycles per second) is measured in Megahertz (106
cycles/sec) or Gigahertz (109 cycles/sec)

Microprocessor:
A processor’s instruction set is a determining factor in its architecture. On the basis of
the instruction set, microprocessors are classi ed as—Reduced Instruction Set
Computer (RISC), and Complex Instruction Set Computer (CISC).

CISC ( Complex Instruction Set Computer)


• Large instruction set including simple and complex instructions
• Variable length instructions (8, 16, 32, 64 bits)
• Due to increased number of instructions (i.e. 200 to 300) it require millions of
transistors.
• Mostly used in Personal Computers.
• Variety of Addressing Modes.
• A large number of application programs are written for this type of processors.
• The x86 instruction set of the original Intel 8086 processor is of the CISC type.
• The PCs are based on the x86 instruction set.
fi
Page 25

• AMD and Cyrix are also based upon CISC.

RISC ( Reduced Instruction Set Computer)


• Small instruction set.
• Simple, single-cycle instructions.
• Reduces reference to memory to retrieve operands.
• RISC architecture does not have hardwired advanced functions.
• All high-level language support is done in the software.
• RISC has fewer instructions and requires fewer transistors, which results in the
reduced manufacturing cost of processor.
• The instruction size is xed (32 bits).
• The processor need not spend time in nding out where each instruction begins and
ends.
• The instructions are simple in nature, are executed in just one clock cycle, which
speeds up the program execution when compared to CISC processors.
• Apple Mac G3 and Power PC are based on RISC.

➡ Processors like Athlon XP and Pentium IV use a hybrid of both technologies.

EPIC (Explicitly Parallel Instruction Computing )


Mostly used in high-end servers and workstations.

✓Reduced Instruction Set Computer (RISC)


✓Complex Instruction Set Computer (CISC)
✓Minimal instruction set computers (MISC)
✓Very long instruction word (VLIW)
✓Explicitly parallel instruction computing (EPIC)
✓One instruction set computer (OISC)
✓Zero instruction set computer (ZISC)
fi
fi
Page 26

Pipelining
It improves instruction execution speed by putting the execution steps into parallel. A
CPU can receive a single instruction, begin executing it, and receive another
instruction before it has completed the rst. It is also called instruction prefetch.

Parallel Processing
It is the simultaneous execution of instructions from the same program on different
processors. A program is divided into multiple processes that are handled in parallel
in order to reduce execution time.
fi

You might also like