CS 2 Main Memory and Backing Store

Post on 09-Jan-2016

21 views 3 download

Tags:

description

CS 2 Main Memory and Backing Store. Memory address (1). Memory is “place’ to store digital signals (0 1). 0100 1000. Memory address (2). 0100 1000. 0111 1100. 0110 1010. …. …. 0000 1010. Memory can allowed Read / Write. Memory. Address = location. 0000 0000. 0000 0001. 0000 0010. - PowerPoint PPT Presentation

Transcript of CS 2 Main Memory and Backing Store

CS 2 CS 2 Main Memory Main Memory

and and Backing StoreBacking Store

2

0100 10000100 1000

Memory address (1)Memory address (1)

Memory is “place’ Memory is “place’ to store digital to store digital signals (0 1)signals (0 1)

3

Memory address (2)Memory address (2)

0100 10000100 1000

0111 11000111 1100

0110 10100110 1010

……. ….... …...

0000 10100000 1010

Memory can allowed

Read / Write

To R/W data, you must

know where it is?

Address = location

0000 0000

0000 0001

0000 0010

1111 1111

4

Memory address (3)Memory address (3)

0 00 00 00 0

0 10 10 10 1

1 01 01 01 0

1 11 11 11 1

What is the MEORY SIZE?

0000 0000

0000 0001

0000 0010

1111 1111

…. ….

5

Memory Size (1)Memory Size (1)

00

00 00 00 00 00 00 00 00

WORDWORD??

6

Memory Size (2)Memory Size (2)

ONE ONE WORWOR

DD

Depends on Computer Type

Operating system Required word size

MS DOS 8 bits

MS Windows 3.1 16 bits

MS Windows 95/98/NT/2000/XP

32 bits

Linux 32 bits

Table of word sizes

7

Wikipedia – 64-bit

8

1 1 kilobytekilobyte (1 (1KB) = KB) = 2210 bytes =bytes =1024 bytes bytes

1 1 megabytemegabyte (1 (1MB) = MB) = 2210 KB KB = 2 = 220 bytesbytes

1 1 TbyteTbyte (1 (1TB) = TB) = 2210 GB GB = 2 = 240 bytesbytes

Memory Size (3)Memory Size (3)

1 1 gigabytegigabyte (1 (1GB) = GB) = 2210 MB MB = 2 = 230 bytesbytes

Questions ...Questions ...

9

CS 2.2Exercise

10

Exercise 1

1. How many bits are there in 1 Mbytes?

Soln:

1Mbytes

= 1 x 1024 x 1024 bytes

= 1048576 x 8 bits

= 8388608 bits

11

Exercise 1

2. A Computer has 4K words of main storage. Each word comprises 24 bits. How many bytes are there in the whole memory? How address lines are required?

Soln: # of bytes in whole memory= 4K x 3 bytes 12 KB

# of address lines required:Since 2n 12KB , 213 = 8192 and 214 = 16384 n = 14

12

Exercise 1

3. A 40 Mbytes memory chip is _______ times a 512 Kbytes chip.

Soln: 40MB 512 KB

= 40 x 1024 KB 512 KB= 80 A 40 Mbytes memory chip is 80 times a

512 Kbytes chip.

13

Exercise 1

4. If the addresses of the locations of a computer are from 0 to 20000, how many address bits are required for addresssing?

Soln:

# of address lines required:

Since 2n 20001,

and 215 = 32768

n = 15

14

StorageStorage─ ─ stores programs and datastores programs and data─ ─ stores programs and datastores programs and data

Storage UnitStorage Unit

Main Memory Backing Store

Random Random Access Access

Memory Memory (RAM)(RAM)

Random Random Access Access

Memory Memory (RAM)(RAM)

Read Only Read Only Memory Memory (ROM)(ROM)

Read Only Read Only Memory Memory (ROM)(ROM)

Store Store large amounts large amounts of data, of data, programs and information programs and information permanentlypermanently even when the even when the computer is turned off.computer is turned off.

Store Store large amounts large amounts of data, of data, programs and information programs and information permanentlypermanently even when the even when the computer is turned off.computer is turned off.

15

RRandom andom AAccess ccess MMemory (RAM)emory (RAM)

─ ─ temporarily stores programs temporarily stores programs and data that are to be executed and data that are to be executed or processed by the CPUor processed by the CPU

Any area of RAM can be Any area of RAM can be accessed directly and accessed directly and immediately by the CPU.immediately by the CPU.

Any area of RAM can be Any area of RAM can be accessed directly and accessed directly and immediately by the CPU.immediately by the CPU.

RAMRAM

16

RAMRAM

Virtual memory– Part of the Hard disk for extending RAM– Capacity of RAM is fixed– Data not frequently used are moved to the

hard disk to make room for new data

Swapping– Moving data between RAM and Hard disk– Done by the computer automatically– Transparent to user

17

RAMRAM

Too much Swapping– Reduce performance of computer, or– Lead to system crash

To reduce Swapping– Increase the size of RAM

18

RRead-ead-OOnly nly MMemory (ROM)emory (ROM)

- - stores the essential software of stores the essential software of the computer system.the computer system.

‘‘Read-only’ means ROM Read-only’ means ROM can be read but not changed.can be read but not changed.

‘‘Read-only’ means ROM Read-only’ means ROM can be read but not changed.can be read but not changed.

ROMROM

19

ROMROM

The contents of ROM are The contents of ROM are preset by the ROM preset by the ROM manufacturer, and can’t manufacturer, and can’t be changed by users.be changed by users.

BIOS is an example BIOS is an example of ROM..of ROM..

BIOS is an example BIOS is an example of ROM..of ROM..

20

RAM vs ROMRAM vs ROM

RAM ROMIt is volatile, i.e. data stored will disappear if the power supply is turned off.

It is non-volatile, i.e. the memory will retain its content even if the power is turned off.

Data can be read from it or written into, i.e. Read-write.

Data init can be read only and cannot be over written, i.e. Read-only.

It is used for temporary storage of running program and working data.

It is used for storing permanent system programs such as BIOS.

21

Complementary Metal-Oxide Semiconductor

Contents can be changed

Non-volatile

Stores configuration about a computer, including

Capacity of the hard disk

Types of existing ports, keyboard and monitor

Current time and date

CMOS does not store programs

CMOSCMOS

22

Small amount of high speed memory

Designed to supply CPU with the most frequently requested data and instruction

First locate in cache first, then RAM

CacheCache

23

ComparisonComparison

24

Why should we have secondary Why should we have secondary storage?storage?

Why should we have secondary Why should we have secondary storage?storage?

Backing StoreBacking Store

LargeLarge storage capacity storage capacity PermanentPermanent storage storage LowerLower cost cost

Secondary storage provides permanent storage for Secondary storage provides permanent storage for large amounts of programs and data that need not be large amounts of programs and data that need not be immediately accessed by the CPU.immediately accessed by the CPU.

Secondary storage provides permanent storage for Secondary storage provides permanent storage for large amounts of programs and data that need not be large amounts of programs and data that need not be immediately accessed by the CPU.immediately accessed by the CPU.

25

Magnetic TapeMagnetic Tape

used for used for backup backup

data in computersdata in computers

sequential accesssequential access

Magnetic Tape (1)Magnetic Tape (1)

26

File store on magnetic tapeFile store on magnetic tape

Magnetic Tape (2)Magnetic Tape (2)

Tape File consists on Tape File consists on HeaderHeader, , Data blocks Data blocks and and Inter Blocks Gap (IBG)Inter Blocks Gap (IBG)

To retrieve To retrieve aa record, you record, you must read must read allall record first. record first.

Sequential Sequential AccessAccess

Sequential Sequential AccessAccess

SLOWER!SLOWER!SLOWER!SLOWER!

27

Hard disk driveHard disk drive

Removable hard diskRemovable hard disk

Magnetic Disk (1)Magnetic Disk (1)Magnetic DiskMagnetic Disk

Floppy diskFloppy disk

28

Magnetic Disk FileMagnetic Disk File

Magnetic Disk (2)Magnetic Disk (2)

29

CD-ROM Drive

Direct access (fast)

CD Writer

It can be used to read It can be used to read data from and write data data from and write data to optical disks such as to optical disks such as CD-R and CD-RW.CD-R and CD-RW.

CD-ROM (1)CD-ROM (1)Optical Disk DriveOptical Disk Drive

Data is read-only.

Compact disk read-only memory

30

Optical DiskOptical DiskInformation is stored Information is stored by using a laser by using a laser beam to burn holes beam to burn holes on a thin coating of on a thin coating of metal.metal.

Information is stored Information is stored by using a laser by using a laser beam to burn holes beam to burn holes on a thin coating of on a thin coating of metal.metal.

Another laser beam is used to read the hole patterns.

Another laser beam is used to read the hole patterns.

CD-ROM (2)CD-ROM (2)

UsageUsage

EncyclopediasEncyclopedias

Film (VCD)Film (VCD)

31

CD-ROM (3)CD-ROM (3)

32

DVDDVD

•Digital Versatile Disk•DVDR, DVDRW, DVD-RAM

•4.7GB storage•DL (Dual / Double Layer)

•8.5GB storage

33

Hard Disk Hard Disk

34

Hard Disk Hard Disk

35

Semi-conducting MediaSemi-conducting Media(Flash memory cards)(Flash memory cards)

Uses semi-conductor to record data.

High speed in transferring data, small in size, portable and no mechanical movement.

Becomes popular.

E.g.: CF, MS, SD, MMC, xD, T-flash, etc.

Web site of SanDisk

36

Removable DisksRemovable Disks

Provide both the storage capacity and fact access time of hard disk and the probability of floppy disks.

Examples: – Iomega’s ZIP (100MB)– JAZ (1-2 GB)– Imation’s Superdisk (120MB)

37

BufferBuffer

Disk/ TapeDisk/ Tape

CPUCPU

Speed of CPU is MUCH Speed of CPU is MUCH FasterFaster than any Backing Store than any Backing Store

•Buffer is needed.Buffer is needed.•Usually is RAM or Cache.Usually is RAM or Cache.

•Buffer is needed.Buffer is needed.•Usually is RAM or Cache.Usually is RAM or Cache.

38

Comparison between different backing store

Cost (/ MB) Speed

Flash memory

$2 Fast

Hard disk $0.004

Compact disc $0.0006

Magnetic tape

$0.001

Floppy disk $1.4 Slow

Expensive

Cheap

39

Comparison between different backing store

Storage capacity

Access mode

Portable

Flash memory ??? Direct Yes

Hard disk Highest Direct No

Compact disc Direct Yes

Magnetic tape Sequential

Yes

Floppy disk Lowest Direct Yes

40

Factors affect the performance of computer

Speed of CPU

Capacity of RAM

Speed of hard disk

Free space of hard disk

Width of bus system

Speed of peripherals

Capability of Video cards

Cache memory

41

CS 2.4Exercise

42

Exercise 2

1. Which of the following are the units of data organisation for a magnetic disk?

(1) Cylinder(2) File(3) Record(4) Sector(5) Track

43

Exercise 2

2. Which of the following storage media is non-erasable?

A. Random access memoryB. Magnetic tapeC. Hard diskD. Read only memoryE. Floppy disk

44

Exercise 2

3. A secondary storage device is used because

(1) it provides non-volatile storage;

(2) it can store a large amount of data;

(3) it runs at a great speed.

45

Comparison between main memory and backing store

Main Memory Backing Store

Function Store processing program and data

Store program and data after processing

Storage capacity Low (512MB) High (160GB)

Cost High ($0.8-1.2/MB) Low ($0.004/MB)

Access mode Random access Disk: direct

Tape: sequential

Access time Fast Slow

Performance ROM: non-volatile

RAM: volatile

Non-volatile

ENDEND