Lecture 9-10 Computer Organization and Architecture
Lecture 9-10 Computer Organization and Architecture
Lecture 9-10 Computer Organization and Architecture
CSEN 2202
Lecture 9 – 10
03/02/2020
Magnetic
Tapes
IO Processor Main
Memory
Magnetic
Disks
Cache
(Heavily used
CPU
By
CPU)
Memory Hierarchy
• Registers
• Parts of processor
• Register assignment is made by the compiler
• Register transfer operations are directly controlled by the processor
• Register transfer takes place at processor speed (one clock cycle)
• Some designers may not consider register as a level in memory hierarchy
• Caches
• Multi-level caches are built either on processor chip or on processor board
• On-chip cache is faster than off-chip cache
• Cache is controlled by the Memory Management Unit (MMU)
• Cache is programmer-transparent
• As processor speed has increased at a faster rate than memory speed, multi-level cache system has
become essential
• There could be separate instruction cache and data cache
Memory Hierarchy
• Main Memory
• Also known as Primary memory
• Much larger in size than the cache
• Much smaller in size than the secondary storage
• Implemented by the most cost-effective RAM chips (Dynamic RAM)
• Managed by a Memory Management Unit (MMU) in cooperation with OS
• Disk Drives
• Highest level of online memory
• Holds the system program (OS, compilers), User programs and the data sets
• Also available in the form of RAID
• Backup Storage
• Optical disks and magnetic tape units are offline memory
• Used for archival and backup storage
• Holds copies of present and past user programs, data, processed results and files
Main Memory
• Random Access Memory (RAM)
• Static RAM
• Contains Flip Flops that store binary information
• Volatile (information erased when electrical power is off)
• Easier to use and shorter read and write cycles
• Dynamic RAM
• Stores information in the form of electric charges applied to capacitors
• Capacitors are provided inside the chip by MOS transistors
• Capacitors must have to be recharged by refreshing the dynamic memory
• Refreshing is done every few milliseconds to restore the decaying charge
• Reduced power consumption and larger storage capacity per chip
• Read Only Memory (ROM)
• Storing programs that are permanently resident in the computer
• Storing tables of constants that do not change
Memory Technology
• Different types of semiconductor memory
• Non-Volatile Memory
• Read Only Memory (ROM)
• Programmable Read Only memory (PROM)
• Electrically Erasable Programmable Read Only memory (EEPROM)
• Flash memory
• Volatile Memory
• Random Access Memory (RAM)
• Static Random Access Memory (SRAM)
• Dynamic Random Access Memory (DRAM)
• Synchronous DRAM (SDRAM)
• Rambus DRAM (RDRAM)
Memory Technology (RAM)
• Static Random Access Memory (SRAM)
• Six transistors per cell or bit
• Refreshing not required
• More power efficient
• Access time is much faster compared to DRAM
• Used as cache memory
• Package density is poor compared to DRAM
• More expensive than DRAM and not used as Main memory
• Dynamic Random Access Memory (DRAM)
• Each memory cell consists of a single transistor and a capacitor
• Presence or absence of charge designates bit 1 or 0
• Stored charge tend to decay over time due to leakage
• Charge on the capacitor needs to be refreshed periodically (~ 1msec)
• Refreshing does take time and increases the latency of DRAM
• Advantage: Package density is high, so the cost per bit is low
• Disadvantage: Access time is rather large and leakage current makes it power hungry
• DRAM is used as main memory and not as cache memory
Memory Technology (Dynamic RAM)
• Synchronous Dynamic Random Access Memory (SDRAM)
• Normally DRAM uses asynchronous memory access
• When a memory access request is issued by the CPU, the time by which the requested
data become available, is unpredictable
• In SDRAM, memory access is synchronized by the processor clock
• In Double Data Rate (DDR) SDRAM, data transfer takes place both in the rising and the
falling edge of the clock
• This results in faster data transfer rate and memory access time
• Rambus Dynamic Random Access Memory (RDRAM)
• Developed by Rambus Inc in collaboration with Intel
• Advantage: Faster access time than SDRAM
• Disadvantage: Larger power consumption
Inclusion, Coherence and Locality
• Information stored in a memory hierarchy (M1, M2, …, Mn) should
satisfy three important properties:
• Inclusion
• Coherence
• Locality
• Consider cache memory the innermost level M1, which directly
communicates with CPU registers
• The outermost level Mn contains all the information words
• The collection of all addressable words in Mn forms the virtual address
space of a computer.
Inclusion property
• The inclusion property is mathematically stated as
• M1 is a subset of M2 which is a subset of M3 ……Mn-1 which is a subset of Mn)
• All information items are originally stored in Mn
• During processing, subsets of Mn are copied into Mn-1
• Similarly, subsets of Mn-1 are copied into Mn-2 , and so on.
• If an information word is found in Mi, then copies of the same word would be found in
all upper levels Mi+1, Mi+2, Mi+3, ………., Mn
• A word stored in Mi+1 may not be found in Mi.
• A word miss in Mi implies that it is also missing in from all lower levels Mi-1, Mi-2, ………., M1.
• The highest level is the backup level, where everything can be found.
Coherence property
• Requires that the copies of the same information item at successive memory
levels be consistent
• If a word is modified in cache, then copies of that word must be updated
immediately or eventually at all higher levels
• Frequently used information is often found in the lower levels in order to
minimize the effective access time of the memory hierarchy.
• Two strategies for maintaining the coherence in memory hierarchy:
• Write Through (WT): This demands immediate update in Mi+1 if a word is modified in
Mi, for i = 1, 2, 3, …, n-1
• Write Back (WB): This delays the update in Mi+1 until the word being modified in Mi is
replaced or removed from Mi.
Locality of reference
• Memory references are generated by the CPU for
• Instruction
• Data
• These accesses tend to be clustered in certain regions in
• Time
• Space
• Ordering
• A typical program spends 90% of its execution time on only 10% of the codes, such as,
innermost loop of a nested looping operation.
• Three type of locality:
• Temporal
• Spatial
• Sequential
Locality of reference
• Temporal Locality
• Recently referenced items (instruction/ data) are likely to be referenced again in near future
• Iterative loops, process stacks, temporary variables, subroutines
• Once a loop is entered or a subroutine is called, a small code segment will be referenced repeatedly many
times
• Spatial locality
• Tendency of a process to access items whose addresses are near one another
• Example: Operations on tables or arrays
• Program segments such as routines and macros, tend to be stored in the same neighbourhood of memory
space
• Sequential locality
• Normally the execution of instructions follow a sequential order, unless there is a branch instruction.
• Normally, the ratio of in-order execution to out-of-order execution is 5:1
• The access of a large data array also follows a sequential order.
Thank you