Lecture Two
Lecture Two
Lecture Two
Lecturer:Charles Masoud
Faculty of Computing, Management and Social
Sciences(FCMSS), KIUT.
COURSE CODE: CE2102
PHONE:0767999857
:Course Content
• Introduction
• The Von Neumann Architecture
• Memory Subsystem
• Input/output Subsystem
• The ALU Subsystem
• Instruction Set Design
• Introduction to Processor Architecture
• Intel 80x86 processor and Intel 80x86 Assembly Language
2
?What is Memory
• The memory is the place where the computer holds
current programs and data that are in use.
• The memory unit that communicates directly with the
CPU is called main memory.
• Devices that provide backup storage are called auxiliary
memory or secondary memory
3
Characteristics of a Memory
The memory system can be characterised by:
Location
Capacity
Unit of transfer
Access method
Performance
Physical type
Physical characteristics
4 Organisation.
Location .1
• Processor memory:
The memory like registers is included within the processor and
termed as processor memory. They include program counter
(PC), instruction register (IR), memory address register
(MAR) and memory data register (MDR).
• Internal memory:
It is often termed as main memory and resides within the CPU.
• External memory:
It consists of peripheral storage devices such as disk and magnetic
5 tape that are accessible to processor via i/o controllers.
Access Method .2
• Sequential access: In this access, it must start with
beginning and read through a specific linear sequence. This
means access time of data unit depends on position of
records (unit of data) and previous location.— e.g. tape
• Direct Access: Individual blocks of records have unique
address based on location. Access is accomplished by
jumping (direct access) to general vicinity plus a sequential
search to reach the final location. e.g. disk
6
Access Methods .2
• Random access: The time to access a given location is
independent of the sequence of prior accesses and is
constant. Thus any location can be selected out randomly
and directly addressed and accessed. e.g. RAM
• Associative access: This is random access type of memory
that enables one to make a comparison of desired bit
locations within a word for a specified match, and to do this
for all words simultaneously. e.g. cache
7
Performance .3
• Access time: For random access memory, access time is the
time it takes to perform a read or write operation Whereas
for non-random access, it is the time needed to position
read / write mechanism at desired location.
• Memory Cycle time: It is the total time that is required to
store next memory access operation from the previous
memory access operation.
Memory cycle time = access time plus transient time (any additional
time required before a second access can commence).
8
Performance .3
• Transfer Rate: This is the rate at which data can be
transferred in and out of a memory unit.
9
Physical Types .4
• Semiconductor
RAM
• Magnetic
Disk & Tape
• Optical
CD & DVD
10
Physical Characteristics .5
• Decay: Information decays mean data loss.
• Volatility: Information decays when electrical power is
switched off.
• Erasable: Erasable means permission to erase.
• Power consumption: how much power consumes?
11
The Memory Hierarchy
• The memory hierarchy system consists of all storage devices
employed in a computer system from the slow by high-capacity
auxiliary memory to a relatively faster main memory, to an even
smaller and faster cache memory
• The main memory occupies a central position by being able to
communicate directly with the CPU and with auxiliary memory
devices through an I/O processor
• A special very-high-speed memory called cache is used for storing
segments of programs currently being executed in the CPU and
temporary data frequently needed in the present calculations
12
The Memory Hierarchy
13
The Memory Hierarchy
14
As we go down in the hierarchy
• As you go down in the hierarchy;
Cost per bit decreases
Capacity of memory increases
Access time increases
Frequency of access of memory by processor also decreases.
15
Hierarchy List
• Registers
• L1 Cache
• L2 Cache
• Main memory
• Disk cache
• Disk
• Optical
• Tape
16
Internal or Main Memory
• The main memory is the central unit of the computer system.
• It is relatively large and fast memory to store programs and data
during the computer operation.
• These memories employ semiconductor integrated circuits.
• The basic element of the semiconductor memory is the memory
cell.
• Most of the main memory in a general purpose computer is
made up of RAM integrated circuits chips, but a portion of the
memory may be constructed with ROM chips
17
Internal or Main Memory
• The memory cell has three functional terminals which
carries the electrical signal.
The select terminal: It selects the cell.
The data in terminal: It is used to input data as 0 or 1 and
data out or sense terminal is used for the output of the cell's
state.
The control terminal: It controls the function i.e. it
indicates read and write.
18
Internal or Main Memory
19
External Memory
• The devices that provide backup storage are called external
memory or auxiliary memory. It includes serial access type
such as:
Magnetic tapes
Magnetic disks.
20
Magnetic Tape
• A magnetic tape is the strip of plastic coated with a magnetic
recording medium.
• Data can be recorded and read as a sequence of character
through read / write head. It can be stopped, started to move
forward or in reverse or can be rewound.
• Data on tapes are structured as number of parallel tracks
running length wise. Earlier tape system typically used nine
tracks. This made it possible to store data one byte at a time
with additional parity bit as 9th track. The recording of data in
21 this form is referred to as parallel recording.
Magnetic Disk
• A magnetic disk is a circular plate constructed with metal or plastic
coated with magnetic material often both side of disk are used and
several disk stacked on one spindle which Read/write head available
on each surface.
• All disks rotate together at high speed. Bits are stored in magnetize
surface in spots along concentric circles called tracks.
• The tracks are commonly divided into sections called sectors. After
the read/write head are positioned in specified track the system has
to wait until the rotating disk reaches the specified sector under
read/write head.
22
Optical Disk
• The huge commercial success of CD enabled the
development of low cost optical disk storage technology that
has revolutionized computer data storage.
• Digitally recorded information is imprinted as series of
microscopic pits on the surface of poly carbonate. This is
done with the finely focused high intensity leaser. The pitted
surface is then coated with reflecting surface usually
aluminum or gold. The shiny surface is protected against dust
and scratches by the top coat of acrylic.
23
Cache memory principles
• Cache Memory is a special very high-speed memory.
• The cache is a smaller and faster memory that stores copies
of the data from frequently used main memory locations.
• There are various different independent caches in a CPU,
which store instructions and data.
• The most important use of cache memory is that it is used
to reduce the average time to access data from the main
memory.
24
Characteristics of Cache Memory
• Cache memory is an extremely fast memory type that acts
as a buffer between RAM and the CPU.
• Cache Memory holds frequently requested data and
instructions so that they are immediately available to the
CPU when needed.
• Cache memory is costlier than main memory or disk
memory but more economical than CPU registers.
• Cache Memory is used to speed up and synchronize with a
high-speed CPU.
25
How cache memory is represented in Memory
26
Number of caches
• Caches are classified as L1 and L2 Cache
1. On-chip cache (L1 Cache)
• It is the cache memory on the same chip as the processor,
the on-chip cache. It reduces the processor's external bus
activity and therefore speeds up execution times and
increases overall system performance.
• Requires no bus operation for cache hits
• Short data paths and same speed as other CPU transactions
27
Off-Chip Cache(L2 Cache)
• It is the external cache which is beyond the processor.
• If there is no L2 cache and processor makes an access request for
memory location not in the L1 cache, then processor must access DRAM
or ROM memory across the bus.
• Due to this typically slow bus speed and slow memory access time, this
results in poor performance.
• On the other hand, if an L2 SRAM cache is used, then frequently the
missing information can be quickly retrieved.
• It can be much larger.
• It can be used with a local bus to buffer the CPU cache-misses from the
28 system bus.
Cache Mapping
• Cache mapping refers to the method used to determine
where data is stored in a computer's cache memory.
• There are three different types of mapping used for the
purpose of cache memory which is as follows:
Direct Mapping
Associative Mapping
Set-Associative Mapping
29
Direct Mapping
• In direct-mapped caching, each block of main memory can
only be stored in one specific cache location.
• The mapping is direct because there is a one-to-one
correspondence between a block in main memory and a
block in the cache.
• Example: Imagine a cache with 4 blocks (C0, C1, C2, C3)
and main memory with 16 blocks (M0 to M15). Block M0
can only be stored in cache block C0, M1 in C1, and so on.
30
Associative Mapping
• Associative caching, each block of main memory can be
placed in any cache location without restrictions.
• There is no fixed mapping, and any block can go into any
cache line.
• Example: A fully associative cache with 8 cache lines (C0
to C7) can store any block from main memory (M0 to M15)
in any cache line without restrictions.
31
Set-Associative Mapping
• In set-associative caching, each block of main memory can be
mapped to a set of cache locations. Each set contains multiple
cache lines.
• The mapping is associative because a block in main memory
can be placed in any cache line within its corresponding set.
• Example: Consider a 2-way set-associative cache with 4 sets
and 8 cache lines (C00 to C07, C10 to C17, and so on). Block
M0 could be placed in either C00 or C01, while M1 could be
placed in C10 or C11.
32
Advantages of Cache Memory
• Cache Memory is faster in comparison to main memory and
secondary memory.
• Programs stored by Cache Memory can be executed in less
time.
• The data access time of Cache Memory is less than that of
the main memory.
• Cache Memory store data and instructions that are regularly
used by the CPU, therefore it increases the performance of
the CPU.
33
Disadvantages of Cache Memory
• Cache Memory is costlier than primary memory and
secondary memory.
• Data is stored on a temporary basis in Cache Memory.
• Whenever the system is turned off, data and instructions
stored in cache memory get destroyed.
• The high cost of cache memory increases the price of the
Computer System.
34
Assignment 02
• What are mapping functions in cache memory, and how do
they work?
• What is the principle behind hierarchical memory
organization, and how does it improve system
performance?
• Name some common semiconductor memory technologies
used in computers.
35