Presentation is loading. Please wait.

Presentation is loading. Please wait.

Main Memory Main memory – –a collection of storage locations, –each with a unique identifier called the address. Word- –Data are transferred to and from.

Similar presentations


Presentation on theme: "Main Memory Main memory – –a collection of storage locations, –each with a unique identifier called the address. Word- –Data are transferred to and from."— Presentation transcript:

1

2 Main Memory Main memory – –a collection of storage locations, –each with a unique identifier called the address. Word- –Data are transferred to and from memory in groups of bits called words. –The number of bits that can be stored in one CPU register in a computer.

3 Figure 5-3 Main memory

4 Address Space Although programmers use a name to identify a word, at the hardware level, each word is identified by an address. Address space - –The total number of uniquely identifiable locations in memory. –For example: a memory with 64KB and a word size of 1 byte has an address space that range from 0 to 65535.

5 Table 5.1 Memory units Unit Unit ------------ KB -kilobyte MB -megabyte GB -gigabyte TB -terabyte PB -petabyte EB -exabyte Exact Number of bytes Exact Number of bytes ------------------------ 2 10 bytes 2 20 bytes 2 30 bytes 2 40 bytes 2 50 bytes 2 60 bytes Approximation Approximation ------------ 10 3 bytes 10 6 bytes 10 9 bytes 10 12 bytes 10 15 bytes 10 18 bytes

6 Address as Bit Pattern Because computers operate by storing numbers as bit patterns, the address itself is also represented as a bit pattern. If a computer has N words of memory, you need an unsigned integer of size log 2 N bits to refer to each memory location. Memory addresses are defined using unsigned binary integers. Note:

7 Example 1 A computer has 32 MB (megabytes) of memory. How many bits are needed to address any single byte in memory? Solution The memory address space is 32 MB, or 2 25 (2 5 x 2 20 ). This means you need log 2 2 25 or 25 bits, to address each byte.

8 Example 2 A computer has 128 MB of memory. Each word in this computer is 8 bytes. How many bits are needed to address any single word in memory? Solution The memory address space is 128 MB, which means 2 27. However, each word is 8 (2 3 ) bytes, which means that you have 2 24 words. This means you need log 2 2 24 or 24 bits, to address each word.

9 Memory Types RAM (Random Access Memory) –Volatile –R/W by user –Two categories: DRAM(Dynamic RAM) –Refresh –used in most PCs SRAM(Static RAM) –No refresh –faster 、 more reliable –more expensive –often used only as a memory cache

10 Memory Types ROM (Read Only Memory) –Nonvolatile –Written by manufacture –Hold the booting program –Categories: ROM PROM(Programmable ROM)- Write once by user EPROM(Erasable PROM)- physical removal and reinstallation by special device EEPROM(Electronically EPROM)- without being removed from computer

11 Figure 5-4 Memory hierarchy SpeedSpaceCost Secondary Memory

12 Cache Memory Figure 5-5 Cache memory at any time contains a copy of a portion of main memory. 1.CPU checks the cache 2.If exist, copy the word, otherwise 1)access main memory and copy a block of memory starting with the desired word. 2)CPU accesses cache and copies the word.

13 Cache It is very probable that the CPU, in next cycle, needs to access the words following the first word. The existence of the cache speeds processing. 80-20 rule Most computers typically spend 80% of the time accessing only 20% of the data. Same data are accessed over and over again.

14

15 Input/Output Subsystem I/O subsystem allows a computer to –Communicate with the outside world –Store programs and data even when the power is off.

16 Nonstorage devices allows the CPU/memory to communicate with the outside world Keyboard – provides input Monitor –display output –Echoes the input typed on the keyboard Printer

17 Storage devices can store large amount of information to be retrieved at a later time. Cheaper than main memory Nonvolatile Auxiliary storage device (Secondary memory) Categories: –Magnetic –optical

18 Magnetic Storage devices Use magnetization to store bits of data If a spot is magnetized  1 If a spot is not magnetized  0 Magnetic Disk –Random access device Magnetic Tape –Sequential access device

19 Figure 5-6 Physical layout of a magnetic disk Performance depends on several factors  Rotational speed  Seek time – the time to move the R/W head to desired track  Transfer time – the time to move data from the disk to the CPU/Memory

20 Figure 5-7 Surface organization of a disk Each surface is divided into tracks Each track is divided into sectors Sector- the smallest storage area that can be accessed at one time. Block- can be stored in one or more sectors and retrieved together.

21 Figure 5-8 Mechanical configuration of a tape

22 Surface organization of a tape Sequential access Slower Cheaper Backup large amount of data 9 vertical spots  8 bits of information  1 bit for error detection Figure 5-9

23 Optical Storage devices Use light (laser) to store and retrieve data. CD-ROM(Compact disc read-only memory) –Same technology as CD CD-R (Compact disc recordable) –WORM(Write Once, Read Many) CD-RW (Compact disc rewritable) –Also called Erasable optical disc DVD(Digital Versatile Disc) –Higher capacity

24 Memory hierarchy Secondary Memory SpeedSpaceCost Hard disk Floppy disk (Diskette) Flash memory CD-R/CD-RW/DVD Magnetic tape

25

26 Connecting CPU and memory using three buses Data bus- # of wires depends on the size of the word. Address bus- # of wires depends on the address space of memory. Control bus- # of wires depends on the total number of control commands a computer needs. Figure 5-14

27 Connecting I/O devices The CPU and memory are electronic devices. The I/O devices are eletromechanical, magnetic, or optical devices. –Much slower speed –Need for an intermediary- I/O controller (or interface) Serial controller- only one wire connection to the device Parallel controller- several connections to the device

28 Figure 5-15 Connecting I/O devices to the buses

29 SCSI controller SCSI(Small Computer System Interface)  Parallel (8/16/32 bits)  Daisy chained connection  Unique ID for each device Figure 5-16

30 Figure 5-17 FireWire controller IEEE 1394 (iLink)  serial  High speed up to 50MB/sec (400Mbps)  Daisy-chain/Tree connection  1394b (800Mbps)

31 USB controller Figure 5-18 USB(Universal Serial Bus)  serial  1.0 (12 Mbps)  2.0 (480 Mbps)

32 Addressing I/O devices The CPU use the same bus to R/W memory and I/O devices.  The only difference is the instruction. Two methods to handle the addressing of I/O devices –Isolated I/O –Memory-Mapped I/O

33 Figure 5-19 Isolated I/O addressing Different instructions The I/O addresses can overlap with memory addresses without any ambiguity because the instruction itself is different.

34 Figure 5-20 Memory-mapped I/O addressing Same instructions The CPU treats each register in the I/O controller as a word in memory. Adv. – smaller # of instructions Disadv. – part of the address space allocated for I/O

35

36 Program Execution General–purpose computers use a set of instructions called a program to process data. Both the program and the data are stored in memory. The CPU uses repeating machine cycles to execute instructions in the program, one by one. A simplified cycle consists of: 1.Fetch 2.Decode 3.Execute

37 Figure 5-21 Steps of a cycle


Download ppt "Main Memory Main memory – –a collection of storage locations, –each with a unique identifier called the address. Word- –Data are transferred to and from."

Similar presentations


Ads by Google