Top Banner
3.0 COMPUTER MEMORY 3.1 MAIN MEMORY 3.2 CACHE MEMORY 3.3 INTERNAL PROCESSOR MEMORY 3.4 VIRTUAL STORAGE
24

3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

Mar 16, 2018

Download

Documents

LêHạnh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

3 .0 CO M PUT ER M EM O RY

3 . 1 M A I N M E M O RY

3 . 2 C AC H E M E M O RY

3 . 3 I N T E R N A L P RO C E S S O R M E M O RY

3 . 4 V I RT UA L S TO R AGE

Page 2: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

3.0 COMPUTER MEMORY• Any physical device capable of storing information temporarily or permanently.

Page 3: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

Aspects Volatile Memory Non – volatile memory

Definition Memory that loses its

contents when the computer

or hardware device loses

power.

Memory that keep its content

even if the power is lost

Example RAM – is why if your

computer freezes or reboots

when working on a program,

you lose anything that hasn’t

been saved.

EPROM - erasable

programmable read-only

memory

Others NVRAM – non volatile random

access memory

is programmable read-only

memory (programmable ROM)

that can be erased and re-used

Page 4: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data
Page 5: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

MEMORY VS STORAGE

RAM is memory / primary

memory

Hard disk – storage / secondary

storage

Hard Drive space is always more

than RAM

Page 6: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

• Cache hit -Data found in cache. Results in data transfer at maximum speed.

• Cache miss- Data not found in cache. Processor loads data from M and copies into

cache. This results in extra delay, called miss penalty.

• Hit ratio = percentage of memory accesses satisfied by the cache.

• Miss ratio = 1-hit ratio

• 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 M from which the line has been copied.

Page 7: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

HOW MEMORY IS USED ???• When a program such as your Internet browser is open, it is loaded from your hard drive

and placed into RAM, which allows that program to communicate with the processor at

higher speeds.

• Anything you save to your computer, such as a picture or video, is sent to your hard drive

for storage.

Types of RAMEDO

RAM

SDRAM

DDR

RAM

DDR2 RAM

DDR3 RAM

DDR4 RAM

Page 8: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

3.1 MAIN MEMORY

• Refers to physical memory that is internal to the computer. (RAM)

• The word main is used to distinguish it from external mass storage devices such

as disk drives.

• Programs and data copied from secondary memory into main memory where the

processor can interact with them.

• A copy remains in secondary memory

• One megabyte of memory is enough to hold approximately one million (106)

characters of a word processing document.

• Nothing permanent is kept in main memory.

Page 9: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

3.2 CACHE MEMORY

• Term cache refers to hidden

• = CPU memory

• Is RAM that a computer microprocessor can access more quickly than it can access regular RAM.

• The function of the cache memory is to reduce latency of MM data access

• The Cache is a memory that stores temporary data, in "silent mode" to upper level of

utilization, for a quick reusing.

Page 10: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

• Locality of reference, also known as the principle of locality, is a term for the

phenomenon in which the same values, or related storage locations, are frequently accessed,

depending on the memory access pattern

Temporal

Data which have been used

recently have high likelihood of

being used again.

Spatial

If a data is referenced, it is

very likely that nearby data

will be accessed soon

Page 11: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data
Page 12: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

Fully Associative Cache

Directory Data

Data attribute bits

/ state Data address ADD

(address of memory block)

2 fields

2 arrays

Page 13: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

“No restriction on mapping

from M to C.” Associative

search of tags is expensive.

Feasible for very small size

caches only.

A given memory block

can be mapped into one

and only cache line.

Page 14: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

• Time Average memory access time = Hit time + Miss rate x Miss penalty

• Assume that

• Hit time = 5 ns (nano seconds)

• Miss rate = 10%

• Miss penalty = 100 ns (nano seconds)

• The average memory access time = 15 ns.

• Better performance at a cheaper price.

Page 15: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

DIRECT MAPPED CACHE

Advantage Disadvantage

No need of expensive

associative search

Miss rate may go

up due to

possible increase

of mapping

conflicts

Page 16: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

Each M-block can now be mapped into any one

of a set of N C-blocks. The sets are predefined.

Let there be K blocks in the cache. Then

N = 1 Direct-mapped cache

N = K Fully associative cache

Most commercial cache have N= 2, 4, or 8.

Cheaper than a fully associative cache.

Lower miss ratio than a direct mapped cache.

Page 17: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

ADDRESS TRANSLATION: AN EX AMPLE

Main memory size = 2 KB

Block size = 8 bytes

Cache size = 64 bytes

Set size = 2

No. of sets in cache = 4

To locate an M-block in cache, check

the tags in the set S = (M-block) mod

(number of sets) i.e. the index field.

Page 18: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

CACHE MEMORY LEVEL EXPL AINED

• Cache memory is fast and expensive. Traditionally, it is categorized as "levels" that describe its

closeness and accessibility to the microprocessor:

• Level 1 (L1) cache is extremely fast but relatively small, and is usually embedded in the

processor chip (CPU).

• Level 2 (L2) cache is often more capacious than L1; it may be located on the CPU or on a

separate chip or coprocessor with a high-speed alternative system bus interconnecting the

cache to the CPU, so as not to be slowed by traffic on the main system bus.

• Level 3 (L3) cache is typically specialized memory that works to improve the performance

of L1 and L2. It can be significantly slower than L1 or L2, but is usually double the speed of

RAM. In the case of multicore processors, each core may have its own dedicated L1 and L2

cache, but share a common L3 cache. When an instruction is referenced in the L3 cache, it is

typically elevated to a higher tier cache.

Page 19: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

• By keeping as much of this information as possible in SRAM, the computer avoids

accessing the slower DRAM, making the computer perform faster and more efficiently.

Today, most computers come with L3 Cache or L2 cache, while older computers

included only L1 cache. Below is an example of the Intel i7 processor and its shared L3

cache.

Page 20: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

• Cache, Internet browser cache, or temporary Internet files with an Internet

browser, like Google Chrome, Firefox, or Internet Explorer, is used to improve how

fast data loads while browsing the Internet.

• In most cases, each time you open a web page, the page and all its files are sent to

the browser's temporary cache on the hard drive. If the web page and files contained

on that web page (e.g. pictures) need to load again and have not been modified, the

browser opens the page from your cache instead of downloading the page again.

• Cache saves lots of time, especially if you use a modem, and can also help save on

bandwidth for the website owner.

• Anyone concerned about their privacy or wants to hide pages they have visited on

the computer can clear their Internet cache (history).

• Like memory caching, disk caching is used to access commonly accessed data.

However, instead of using high-speed SRAM, a disk cache uses conventional main

memory.

Page 21: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

• The most recently accessed data from a disk is stored in a memory buffer. When a

program needs to access data from the disk, it first checks the disk cache to see if the

data is there.

• Disk caching can dramatically improve the performance of applications because accessing

a byte of data in RAM can be thousands of times faster than accessing a byte of data on a

hard drive.

• A cache server is a computer or network device set up to store web pages that have

been accessed by users on a network. Any user trying to access a web page stored on the

cache server is sent the stored version, instead of downloading the web page again.

• Cache servers help reduce network and Internet traffic congestion, as well as save the

company on bandwidth costs.

Page 22: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

INTERNAL PROCESSOR MEMORY

• Typically refers to main memory, but may also refer to ROM and flash memory.

• In either case, internal memory generally refers to chips rather than disks or

tapes.

• RAM – A series of chips on the motherboard

Page 23: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

VIRTUAL STORAGE

• A system for storing computer data in more than one place so that it can be used by any

computer connected to the system, for example over the internet

• Virtual memory

Page 24: 3.0 Computer Memory - · PDF fileMEMORY VS STORAGE RAM is memory / primary ... Hard disk –storage / secondary storage ... VIRTUAL STORAGE •A system for storing computer data

Answer ALL questions.

1. What is computer memory?

2. Write the full name for the acronym given:

ROM: .......................................................................

RAM: .......................................................................

3. State the characteristic of ROM.

4. State the characteristic of RAM.

5. What is cache memory?

6. What is the function of virtual storage?

7. Give TWO examples of virtual storage.