1
Fundamentals of Computers and IT
Paper Code 105
UNIT – 1
Processor (CPU) & Memory
Chapter 7: P. K. Sinha
2
Introduction to Computers and IT
UNIT – 1
Fundamentals of Computers:
Definition and Characteristics of Computer System, Computer Generation from First Generation to Fifth
Generation. Classifications of Computers: Micro, Mini, Mainframe and super computers.
Computer Hardware: Major Components of a digital computer, Block Diagram of a computer, Input-
output devices, Description of Computer Input Units, Output Units, CPU.
Computer Memory: Memory Hierarchy, Primary Memory - RAM and its types, ROM and its types,
Secondary Memory, Cache Memory, Secondary Storage Devices- Hard disk, Compact Disk, DVD, Flash
memory.
3
Chapter 7: P. K. Sinha
Learning Objectives
4
In this section you will learn about:
▪ Internal structure and functioning of CPU also called processor
and structure of Primary storage also known as Main memory
or simply memory
▪ Determining the speed of a processor
▪ Different types of processors available
▪ Determining the capacity of a memory
▪ Different types of memory available
▪ Several other terms related to the processor and main memory of
a computer system
Basic architecture of Processor and Memory
5
of a Computer System
6 Central Processing Unit(CPU)
It is the brain of a computer system
It performs all major calculations and comparisons and also activates
and controls the operations of other units of a computer system
Two basic components are:
▪ Control Unit (CU) and
▪ Arithmetic Logic Unit (ALU)
No other single component of a computer determines its overall
performance as much as the CPU
Control Unit(CU)
7
It is one of the two basic components of CPU
It acts as the central nervous system of a computer system
It selects and interprets program instructions, and then coordinates their
execution
It has some special purpose registers and a decoder to perform these activities
The special purpose registers are:
Instruction register which holds the current instruction and the
Program Counter register which holds the next instruction to be
executed by the computer system
The Decoder has necessary circuitry to decode and interpret the
instruction supported by the CPU.
Control Unit(CU)
8
It is one of the two basic components of CPU
It acts as the central nervous system of a computer system
It selects and interprets program instructions, and then coordinates their
execution
It has some special purpose registers and a decoder to perform these activities
The special purpose registers are:
Instruction register which holds the current instruction and the
Program Counter register which holds the next instruction to be
executed by the computer system
The Decoder has necessary circuitry to decode and interpret the
instruction supported by the CPU.
9 Arithmetic and Logical Unit(ALU)
It is one of the two basic components of CPU
Actual execution of instructions takes place in ALU
It has some special purpose registers and has necessary circuitry to carry
out all the arithmetic and logic operations included in the CPU instruction
set
When entire CPU (both CU and ALU) is contained on a single silicon
chip, it is called a microprocessor
10 What is Computer Instruction
A computer program is a sequence of instructions.
An instruction performs on stored data.
An instruction is designed to perform a task.
An instruction has two parts/components
- the OPCODE field
- it defines type of operation
- it operates on stored data
- address field
- contain one or more addresses of data on which the operation is to be
performed
Data may be stored in a CPU register or in the main memory
11 What is Computer Instruction
A computer program is a sequence of instructions.
An instruction performs on stored data.
An instruction is designed to perform a task.
An instruction has two parts/components
- the OPCODE field
- it defines type of operation
- it operates on stored data
- address field
- contain one or more addresses of data on which the operation is to be
performed
Data may be stored in a CPU register or in the main memory
12 Instruction Format
Operation Code Operand Address
ADD op code 1st operand address 2nd operand address
Instruction format for ADD command
13 Instruction Format
Operation Code Operand Address
ADD op code 1st operand address 2nd operand address
Instruction format for ADD command
14
Instruction Set
15
Every CPU/Processor has built-in ability to execute a set of instructions called as
instruction set
Examples:
ADD R1, R2 : R2<- R1+R2, TO add two numbers where R1 and R2
are processor(CPU) registers that hold data
LOAD R1,A
ADD R1,B
STORE R1,X
SUB R1, R2
Most CPUs have 200 or more instructions (such as add, subtract, compare, etc.) in
their instruction set
CPUs made by different manufacturers have different instruction sets
New CPU whose instruction set includes instruction set of its predecessor CPU is
said to be backward compatible with its predecessor
16 Registers
Registers are small (low storage capacity) and high speed storage
devices within the CPU.
They are used to hold information on a temporary basis as the
instructions are interpreted and executed by the CPU
Registers store data, instructions, addresses, intermediate results
etc.
The length of a register, sometimes called its word size, equals the
number of bits it can store
With all other parameters being the same, a CPU with 32-bit
registers can process data twice larger than one with 16-bit
registers
17
▪ Different registers hold different things
▪ instructions and addresses of instructions
▪ data (operands)
▪ results of operations
Functions of commonly used Registers
18
Functions of commonly used Registers
19
Functions of commonly used Registers
20
21 INSTRUCTION CYCLE:
CPU executes each instruction in a series of steps called instruction cycle.
It involves four steps:
Fetching
Decoding
Executing
Storing
22
Steps for executing of an instruction by
23 the CPU
24
Processor Speed
25
CU and ALU performs operations at incredible speed
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, such as moving a byte of data from one
memory location to another
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 (MHz) (106
cycles/sec) or Gigahertz (GHz) (109 cycles/sec)
Normally we measure speed of
▪ PCs in MHz Or GHz,
▪ workstations/mainframes in MIPS(Millions of instructions per second) / BIPS
(Billions of Instructions per second),
▪ whereas the speed of super computers in terms of MFLOPS(Millions of Floating Point
Operations per second) / GFLOPS(Gigaflops which refers Billions FLOPS) / TFLOPS
(Teraflops)
26
Types of Processor
27 On the basis of the instruction set, microprocessors are classified as:
RISC (Reduced instruction Set Computer)
CISC (Complex instruction Set Computer)
RISC CISC
Simple, single-cycle instructions Complex instructions
which performs basic operations
Small instruction set Large instruction set
The instruction size is fixed Instructions are of variable lengths, 8,16,32 bits
(32bits) for storage.
High speed Low speed
Uses more registers Uses less registers
Mostly used in workstations Mostly used in personal computers
28
Computer Memory:
Memory Hierarchy, Primary Memory - RAM and its
types, ROM and its types, Secondary Memory,
Cache Memory, Secondary Storage Devices- Hard
disk, Compact Disk, DVD, Flash memory.
Computer Memory
29
• A memory unit is a collection of storage cells/words together with associated
circuits need to transfer data/information in and out of storage.
• The memory stores binary information in group of bits called words/cells.
• A memory word is a group of 1’s and 0’s and may represent a number, a character,
an instruction code or alphanumeric characters
Typical data elements are:
• Bit or Binary Digit is the basic unit of memory, is a single binary digit i.e 1 or 0
• Byte – A group of 8-bits. 1 byte is the smallest unit of data that is handled by the
computer system.
• Word/Cell – A collection of binary bits whose size is a typical unit of access for
memory. A word can be of 1 byte, 2 bytes, 4 bytes, 8 bytes etc. that is multiple of 2
30
Main Memory Organization
31
It identifies the structure that determines how data is accessed. Memory is
logically organized as an array/collection of words/cells.
Figure 1 and 2 shown below is the organization of N x n memory and 4096 x
16 memory respectively.
Figure 1: N x n memory Figure 2: 4096 x 16 memory
32
Machines having smaller word-length are slower in operation than
machines having larger word-length
A write to a memory location is destructive to its previous contents
A read from a memory location is non-destructive to its previous
contents
33
34
35
36 Fixed and Variable Word Length
Memory
Main memory of some computers can store a fixed no of characters (equal
to its word length in bytes) in each numbered address location. Such
computers are said to be word addressable. These computers always
allocate storage space in multiples of word-length. Therefore, if a word
adorable computer has fixed word-length of 4 bytes (4 characters, it will
require one word (4 bytes) to store the word "CAT" and two words (8 bytes)
to store the word "BOMBAY".
In many computers, main memory is designed to store a single character
(A, B, 1, 2, +, -, etc) at each numbered address. Computers designed in
this manner are said to be character-addressable and they employ variable-
word-length memory approach. Hence, in these computers only 3 bytes are
required to store the word " CAT" and 6 bytes to store the word "BOMBAY".
Figure 7.4 summarizes the difference between fixed-word-length and
variable-word-length memory approaches.
Fixed Word--llength Memory
37
Storage space is always allocated in multiples of word-length
▪ Faster in speed of calculation than variable word-length memory
▪ Normally used in large scientific computers for gaining speed of
calculation
Variable Word--llength Memory
38
Memory Hierarchy
39
The memory is characterized on the
basis of two key factors—capacity and
access time.
Capacity is the amount of information
(in bits) that a memory can store.
Access time is the time interval between
the read/ write request and the
availability of data. The lesser the access
time, the faster is the speed of memory.
Ideally, we want the memory with
fastest speed and largest capacity.
However, the cost of fast memory is
very high.
Storage Evaluation Criteria
40
Any storage unit of a computer system is characterised and
evaluated based on the following properties/characteristics
Categories of Memory
41 Figure:
Memory
Internal External
CPU Registers Magnetic Disk
Cache Memory Optical Disk
Main /Primary Magnetic Tape
Memory
Primary Memory or Main Memory
42 • Primary memory holds only those data and instructions on which the computer is currently working.
• It is the central storage unit in computer.
• It has limited capacity and data is lost when power is switched off.
• It is generally made up of semiconductor devices.
• The data and instruction required to be processed is reside in main memory.
• It is divided into 2 subcategories: RAM (Random Access Memory) & ROM (Read Only Memory)
Characteristics of Main Memory:
1. These are semiconductor devices.
2. Also known as primary memory.
3. Usually volatile memory means data is not permanently stored when power is off.
4. A computer cannot run without primary memory.
5. Faster than secondary memory.
Random Access Memory (RAM)
43
• It is the internal memory of the CPU for storing data, program & results.
• The data & instructions that need to be operated upon by CPU are first brought to RAM
from the secondary devices e.g. hard disk
• It is a volatile memory i.e., RAM losses inform, when the computer is powered off.
• The size of the RAM is limited due to its high cost.
• Physically it consists of some chips either on the motherboard or on small circuit board
attached to the motherboard.
• Data in the RAM can be accessed randomly (i.e., directly or out of sequence) i.e. it require
same amount of time to access information from RAM, irrespective of where it is located in
it.
• The speed of the RAM is expressed in nanoseconds
44
Types of RAM
45 Two types of RAM
DRAM SRAM
Dynamic RAM STATIC RAM
It is used in main memory It is used in cache memory
It has short data life time It stores information as long as it is
supplied with power i.e., has long life
Less power consumption High power consumption
cheap expensive
Slow processing speed High processing speed
It consists of transistors and capacitors It uses multiple transistors
1T 6T
Access speed is 50 to 150ns Access speed is 2 to 10ns
DRAM must be refresh continually to SRAM does not need constant
store information refreshing
ROM (Read Only Memory)
• ROM is a Non-volatile memory i.e. data is permanently stored.
46
• Data stored in a ROM can only be read & they cannot be changed
• ROMs are mainly used to store programs & data, which do not change and are
frequently used. E.g. System boot programs are reside in ROM called BIOS (Basic Input
& Output services) set up program.
Types Of ROM
47
48 RAM Vs ROM
RANDOM ACCESS MEMORY (RAM) READ ONLY MEMORY (ROM)
RAM is volatile ROM is Non-volatile
Temporary storage Permanent storage
Expensive Cheap
Limited storage capacity High storage capacity
RAM stores data and instructions ROM comes programmed by the
during the execution of instructions manufacturer
Types: SRAM & DRAM Types: PROM, EPROM, UVEPROM,
EEPROM
49
Cache Memory
50
• Cache memory is a very high speed & small semiconductor memory which can speed
up CPU.
• It acts as an interface between the CPU & the main memory.
• It is used to temporarily store very active data & instructions during processing.
• It has limited capacity.
• It consumed less access time as compared to main memory.
• It is very expensive.
51