University of the Sulaimani (UOS). Faculty of Science and Sciences Education School of Science...

65
University of the Sulaimani (UOS). Faculty of Science and Sciences Education School of Science Department of Computer CS11 Digital Logic and Organization Lecture 6: Memory System in a Computer Rebaz Nawzad 1

Transcript of University of the Sulaimani (UOS). Faculty of Science and Sciences Education School of Science...

  • Slide 1
  • University of the Sulaimani (UOS). Faculty of Science and Sciences Education School of Science Department of Computer CS11 Digital Logic and Organization Lecture 6: Memory System in a Computer Rebaz Nawzad 1
  • Slide 2
  • 2
  • Slide 3
  • A term for a device that enables the computer to retain (store) information.
  • Slide 4
  • Volatile memory (Random Access Memory/RAM; Cache Memory; Virtual Memory)- Contents of memory are erased when power supply is turned off. Also called Temporary storage. Nonvolatile memory (Read Only Memory/ROM; Flash Memory)- Contents of memory are not erased when power is turned off. Also called Permanent storage.
  • Slide 5
  • A type of volatile memory that stores information temporarily so that its available to the CPU.
  • Slide 6
  • Dynamic RAM- A memory chip that needs to be refreshed periodically or it loses its data Synchronous DRAM (SDRAM)- Synchronized with the computers system clock Rambus DRAM (RDRAM)- Uses fast bus to send and receive data within one clock cycle. Faster than SDRAM Double Data Rate SDRAM (DDR SDRAM)- A type of SDRAM that can send and receive data within one clock cycle.
  • Slide 7
  • A narrow printed circuit board that holds memory chips Three types Single Inline Memory Module (SIMM)- 30 or 72 pin connectors. Available in 1MB, 4MB, 16MB, and 32MB versions ( 1980s to the late 1990s. ) Dual Inline Memory Module (DIMM)- 168 or 184 pin connectors. Available in 8MB, 16MB, 32MB, 64MB, 128MB, 256MB, and 512MB versions Rambus Inline Memory Module (RIMM) (184-pin connector)
  • Slide 8
  • DIMM SIMM NOTEBOOK DIMM RIMM
  • Slide 9
  • CHIPS CONTAIN MEMORY LOCATIONS CALLED MEMORY ADDRESSES THE CPU STORES AND RETRIEVES DATA BY GOING TO THE MEMORY ADDRESSES
  • Slide 10
  • WEB KEYBOARD CPU RAM MONITOR HOW RAM WORKS
  • Slide 11
  • 11 Memory Memory is a collection of cells, each with a unique physical address The size of a cell is normally a power of 2, typically a byte today.
  • Slide 12
  • Primary cache (Level 1 or L1)- Located within the CPU chip, it is the memory the microprocessor uses to store frequently used instructions and data. Secondary cache (Level 2 or L2; Backside Cache)- Located near the CPU, it is the memory between the CPU and RAM Faster than RAM
  • Slide 13
  • Part of the hard disk is reserved as RAM When RAM modules become full the CPU accesses the hard disk to store and retrieve data Slower than RAM FULL
  • Slide 14
  • Memory Hierarchy The memory unit is an essential component in any digital computer since it is needed for storing programs and data Not all accumulated information is needed by the CPU at the same time Therefore, it is more economical to use low-cost storage devices to serve as a backup for storing the information that is not currently used by CPU
  • Slide 15
  • Memory Hierarchy Computer Memory Hierarchy is a pyramid structure that is commonly used to illustrate the significant differences among memory types. The memory unit that directly communicate with CPU is called the main memory Devices that provide backup storage are called auxiliary memory 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
  • Slide 16
  • MEMORY HIERARCHY Magnetic tapes Magnetic disks I/O processor CPU Main memory Cache memory Auxiliary memory Register Cache Main Memory Magnetic Disk Magnetic Tape Memory Hierarchy is to obtain the highest possible access speed while minimizing the total cost of the memory system
  • Slide 17
  • Memory Hierarchy 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 to increase the speed of processing by making current programs and data available to the CPU at a rapid rate
  • Slide 18
  • Memory Hierarchy CPU logic is usually faster than main memory access time, with the result that processing speed is limited primarily by the speed of main memory The cache is used for storing segments of programs currently being executed in the CPU and temporary data frequently needed in the present calculations The typical access time ratio between cache and main memory is about 1to7 Auxiliary memory access time is usually 1000 times that of main memory
  • Slide 19
  • Slide 20
  • Memory devices A memory device is a gadget that helps you record information and recall the information at some later time. Example:
  • Slide 21
  • Memory devices (cont.) Requirement of a memory device: Example: A memory device must have more than 1 states (Otherwise, we can't tell the difference) Memory device in state 0Memory device in state 1
  • Slide 22
  • The switch is a memory device The electrical switch is a memory device: The electrical switch can be in one of these 2 states: off (we will call this state 0) on (we will call this state 1)
  • Slide 23
  • Memory cell used by a computer One switch can be in one of 2 states A row of n switches: can be in one of 2 n states !
  • Slide 24
  • Memory cell used by a computer (cont.) Example: row of 3 switches A row of 3 switches can be in one of 2 3 = 8 states. The 8 possible states are given in the figure above.
  • Slide 25
  • Representing numbers using a row of switches We saw how information can be represented by number by using a code (agreement) Recall: we can use numbers to represent marital status information: 0 = Sunny 1 = Rainy 2 = Snow 3 = cloudy
  • Slide 26
  • Representing numbers using a row of switches (cont.) We can represent each number using a different state of the switches. Example:
  • Slide 27
  • Representing numbers using a row of switches (cont.) To complete the knowledge on how information is represented inside the computer, we will now study: The representation scheme has a chic name: How to use the different states of the switches to represent different numbers the binary number system
  • Slide 28
  • The binary number system The binary number system uses 2 digits to encode a number: That means that you can only use the digits 0 and 1 to write a binary number Example: some binary numbers 0 = represents no value 1 = represents a unit value 0 1 10 11 1010 and so on.
  • Slide 29
  • The binary number system (cont.) Now you should understand how the different states of these 3 switches represent the numbers 0-7 using the binary number system:
  • Slide 30
  • A cute binary number joke Try to understand this joke: (Read: there are binary 10 (= 2) types of people: those who understand binary (numbers) and those who don't)
  • Slide 31
  • A cute binary number joke (cont.) A knock off joke:
  • Slide 32
  • What does all this have to do with a computer ? Recall what we have learned about the Computer RAM memory: The RAM consists of multiple memory cells: Each memory cell stores a number
  • Slide 33
  • What does all this have to do with a computer ? (cont.) The connection between the computer memory and the binary number system is: The computer system uses the binary number encoding to store the number Example:
  • Slide 34
  • What does all this have to do with a computer ? (cont.) Note: the address is also expressed as a binary number A computer can have over 4,000,000,000 bytes (4 Gigabytes) of memory. So we need a 32 bites to express the address
  • Slide 35
  • Computer memory A computer is an electronic device Structure of a RAM memory: The RAM memory used by a computer consists of a large number of electronic switches The switches are organized in rows For historical reason, the number of switches in one row is 8
  • Slide 36
  • Computer memory (cont.) Details In order to store text information in a computer, we need to encode: 26 upper case letters ('A', 'B', and so on) 26 lower case letters ('a', 'b', and so on) 10 digits ('0', '1', and so on) 20 or so special characters ('&', '%', '$', and so on) for a total of about 100 different symbols The nearest even power 2 n that is larger than 100 is: 2 7 = 128 100 For a reason beyond the scope of this course, an 8 th switches is added
  • Slide 37
  • Computer memory (cont.) This is was a portion of the RAM memory looks like: What information is stored in the RAM memory depends on: The type of data (this is the context information) Example of types: marital status, gender, age, salary, and so on. This determines the encoding scheme used to interpret the number
  • Slide 38
  • Computer memory jargon: bit = (binary digit) a smallest memory device A bit is in fact a switch that can remember 0 or 1 (The digits 0 and 1 are digits used in the binary number system) Byte = 8 bits A byte is in fact one row of the RAM memory KByte = kilo byte = 1024 (= 2 10 ) bytes (approximately 1,000 bytes) MByte = mega byte = 1048576 (= 2 20 ) bytes (approximately 1,000,000 bytes) GByte = giga byte = 1073741824 (= 2 30 ) bytes (approximately 1,000,000,000 bytes) TByte = tera byte
  • Slide 39
  • Combining adjacent memory cells A byte has 8 bits and therefore, it can store: 2 8 = 256 different patterns (These 256 patterns are: 00000000, 00000001, 00000010, 00000011,.... 11111111)
  • Slide 40
  • Combining adjacent memory cells (cont.) Each pattern can are encoded exactly one number: Therefore, one byte can store one of 256 possible values (You can store the number 34 into a byte, but you cannot store the number 456, the value is out of range) 00000000 = 0 00000001 = 1 00000010 = 2 00000011 = 3... 11111111 = 255
  • Slide 41
  • Main Memory 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 RAM Random Access memory Integated RAM are available in two possible operating modes, Static and Dynamic ROM Read Only memory
  • Slide 42
  • Main Memory A RAM chip is better suited for communication with the CPU if it has one or more control inputs that select the chip when needed The Block diagram of a RAM chip is shown next slide, the capacity of the memory is 128 words of 8 bits (one byte) per word
  • Slide 43
  • SRAM vs DRAM Summary Tran.Access per bit timePersist? Sensitive? Cost Applications SRAM61X Yes No 100x cache memories DRAM110X No Yes 1X Main memories, frame buffers
  • Slide 44
  • RAM Read/write memory, that initially doesnt contain any data The computing system that it is used in usually stores data at various locations to retrieve it latter from these locations Its data pins are bidirectional (data can flow into or out of the chip via these pins), as opposite to those of ROM that are output only It loses its data once the power is removed, so it is a volatile memory It has a directional select signal R/W; When R/W=1, the chip outputs data to the rest of the circuit; when R/W = 0 it inputs data from the rest of the circuit
  • Slide 45
  • Random-Access Memory Types Different between SRAM & DRAM Static RAM (SRAM) Each cell stores bit with a six-transistor (Diode) circuit. Retains value indefinitely, as long as it is kept powered. Relatively insensitive to disturbances such as electrical noise. Faster and more expensive than DRAM. Dynamic RAM (DRAM) Each cell stores bit with a capacitor and transistor. Value must be refreshed every 10-100 ms. Sensitive to disturbances. Slower and cheaper than SRAM.
  • Slide 46
  • Random-Access Memory Key features RAM is packaged as a chip. Basic storage unit is a cell (one bit per cell). Multiple RAM chips form a memory.
  • Slide 47
  • ROM ROM is used for storing programs that are PERMENTLY resident in the computer and for tables of constants that do not change in value once the production of the computer is completed The ROM portion of main memory is needed for storing an initial program called bootstrap loader, witch is to start the computer software operating when power is turned off
  • Slide 48
  • ROM Data is programmed into the chip using an external ROM programmer The programmed chip is used as a component into the circuit The circuit doesnt change the content of the ROM Can be used as lookup tables to implement various functions Used by PCs to store the instructions that form their Basic Input/Output System (BIOS) When power is removed from a ROM chip, the information is not lost, so it is a nonvolatile type of memory It has an OE (Output Enable) specific control pin. Both OE and CE must be enabled in order for the ROM to output data; otherwise its data output is tri-stated.
  • Slide 49
  • ROM Types Masked ROM programmed with its data when the chip is fabricated PROM programmable ROM, by the user using a standard PROM programmer, by burning some special type of fuses. Once programmed will not be possible to program it again. EPROM erasable ROM; the chip can be erased and chip reprogrammed; programming process consists in charging some internal capacitors; the UV light (method of erase) makes those capacitors to leak their charge, thus resetting the chip EEPROM Electrically Erasable PROM; it is possible to modify individual locations of the memory, leaving others unchanged; one common use of the EEPROM is in BIOS of personal computers.
  • Slide 50
  • ROM
  • Slide 51
  • Nonvolatile Memories DRAM and SRAM are volatile memories Lose information if powered off. Nonvolatile memories retain value even if powered off. Generic name is read-only memory (ROM). Misleading because some ROMs can be read and modified. Types of ROMs Programmable ROM (PROM) Eraseable programmable ROM (EPROM) Electrically eraseable PROM (EEPROM) Flash memory Firmware Program stored in a ROM Boot time code, BIOS (basic input/ouput system) graphics cards, disk controllers.
  • Slide 52
  • Auxiliary Memory The main memory construction is costly. Therefore, it has to be limited in size. The main memory is used to store only those instructions and data which are to be used immediately. However, a computer has to store a large amount of information. The bulk of information is stored in the auxiliary memory. This is also called backing storageor secondary storage. They include hard disk, floppy disks, CD- ROM, USB flash drives, etc. When the electricity supply to the computer is off, all data stored in the primary storage is destroyed. On the other hand, this is not true for secondary storage. The data stored in secondary storage can be stored for the desired time.
  • Slide 53
  • SOME T I P S FOR AUXILIARY MEMORY
  • Slide 54
  • Disk Geometry Disks consist of platters, each with two surfaces. Each surface consists of concentric rings called tracks. Each track consists of sectors separated by gaps. spindle surface tracks track k sectors gaps
  • Slide 55
  • Disk Geometry (Muliple-Platter View) Aligned tracks form a cylinder. cylinder k surface 0 surface 1 surface 2 surface 3 surface 4 surface 5 spindle platter 0 platter 1 platter 2
  • Slide 56
  • Computing Disk Capacity Capacity = (# bytes/sector) x (avg. # sectors/track) x (# tracks/surface) x (# surfaces/platter) x (# platters/disk) Example: 512 bytes/sector 300 sectors/track (on average) 20,000 tracks/surface 2 surfaces/platter 5 platters/disk Capacity = 512 x 300 x 20000 x 2 x 5 = 30,720,000,000 = 30.72 GB
  • Slide 57
  • Disk Operation (Single-Platter View) The disk surface spins at a fixed rotational rate spindle By moving radially, the arm can position the read/write head over any track. The read/write head is attached to the end of the arm and flies over the disk surface on a thin cushion of air. spindle
  • Slide 58
  • Disk Operation (Multi-Platter View) arm read/write heads move in unison from cylinder to cylinder spindle
  • Slide 59
  • Disk Access Time Average time to access some target sector approximated by : Taccess = Tavg seek + Tavg rotation + Tavg transfer Seek time (Tavg seek) Time to position heads over cylinder containing target sector. Typical Tavg seek = 9 ms Rotational latency (Tavg rotation) Time waiting for first bit of target sector to pass under r/w head. Tavg rotation = 1/2 x 1/RPMs x 60 sec/1 min Transfer time (Tavg transfer) Time to read the bits in the target sector. Tavg transfer = 1/RPM x 1/(avg # sectors/track) x 60 secs/1 min.
  • Slide 60
  • Disk Access Time Example Given: Rotational rate = 7,200 RPM Average seek time = 9 ms. Avg # sectors/track = 400. Derived: Tavg rotation = 1/2 x (60 secs/7200 RPM) x 1000 ms/sec = 4 ms. Tavg transfer = 60/7200 RPM x 1/400 secs/track x 1000 ms/sec = 0.02 ms Taccess = 9 ms + 4 ms + 0.02 ms Important points: Access time dominated by seek time and rotational latency. First bit in a sector is the most expensive, the rest are free. SRAM access time is about 4 ns/doubleword, DRAM about 60 ns Disk is about 40,000 times slower than SRAM, 2,500 times slower then DRAM.
  • Slide 61
  • Cache memory When CPU needs to access memory, the cache is examined If the word is found in the cache, it is read from the fast memory If the word addressed by the CPU is not found in the cache, the main memory is accessed to read the word
  • Slide 62
  • Cache memory The performance of cache memory is frequently measured in terms of a quantity called hit ratio When the CPU refers to memory and finds the word in cache, it is said to produce a hit Otherwise, it is a miss Hit ratio = hit / (hit+miss)
  • Slide 63
  • Cache memory The basic characteristic of cache memory is its fast access time, Therefore, very little or no time must be wasted when searching the words in the cache The transformation of data from main memory to cache memory is referred to as a mapping process, there are three types of mapping: Associative mapping Direct mapping Set-associative mapping
  • Slide 64
  • Cache memory To help understand the mapping procedure, we have the following example:
  • Slide 65
  • THE END 65