IT 0213: INTRODUCTION TO COMPTER ARCHITECTURE LECTURE 2 MEMORY Types of memory Secondary Storage
Memory Memory is used to store both the instructions to be executed and data. Is the section where information is stored. The information could be: - Programs Data to be processed Results of computation
Characteristics of computer memory
Types of memory There are two types: The main memory (primary memory) Secondary memory
Computer Memory Two basic categories of computer memory: Primary storage and secondary storage. Primary stores small amounts of data and information that will be immediately used by the CPU. Secondary stores much larger amounts of data and information (an entire software program, for example) for extended periods of time.
Primary Storage Primary storage or main memory stores three types of information for very brief periods of time: Data to be processed by the CPU; Instructions for the CPU as to how to process the data; Operating system programs that manage various aspects of the computer’s operation. Primary storage takes place in chips mounted on the computer’s main circuit board, called the motherboard
It is divided into :-- RAM (Random Access Memory) ROM (Read Only Memory) Registers Cache memory Random access memory (RAM) RAM refers to Random Access Memory where both read and write operations can take place. But the RAM is a volatile memory; its contents are lost when the power is switch off.
Read Only Memory (ROM) ROM refers to read only memory where only read operations can take place. The ROM is non-volatile memory; its contents are not lost when the power is switch off. Registers: registers are part of the CPU with the least capacity, storing extremely limited amounts of instructions and data only immediately before and after processing.
Cache memory: A type of primary storage where the computer can temporarily store blocks of data used more often.
The Memory Hierarchy
Random Access Memory(RAM) RAM is installed inside computers. RAM is also known as a working memory. • The data in RAM can be read (retrieved) or written (stored). • RAM is volatile which means the programs and data in RAM are lost when the computer is powered off. • A computer uses RAM to hold temporary instructions and data needed to complete tasks. This enables the computer's CPU (Central Processing Unit) to access instructions and data stored in the memory very quickly. RAM stores data during and after processing.
Random Access Memory(RAM) RAM can be further classified as: Static RAM (SRAM) Dynamic RAM (DRAM)
Dynamic - stores data as charge on capacitors tend to discharge over time require periodic charge (like a memory reference) to refresh more dense and less expensive than comparable static RAMs Static - stores data in traditional flip-flop logic gates no refresh needed generally faster than dynamic RAMs
Read-only Memory (ROM) ROM is another type of memory permanently stored inside the computer. ROM is non-volatile. It holds the programs and data when the computer is powered off. Programs in ROM have been pre-recorded. It can only be stored by the manufacturer; once it is done, it cannot be changed. Many complex functions, such as start up operating instructions, translators for high-level languages and operating systems are placed in ROM memory. All the contents in ROM can be accessed and read but cannot be changed.
Types of ROM PROM - Programmable Read Only Memory writing process is performed electrically may be written after chip fabrication writing uses different electronics than normal memory writes no room for error attractive for smaller production runs
EPROM - Erasable Programmable Read Only Memory read and written electrically, as with PROM before a write, all cells must be erased by exposure to UV radiation (erasure takes about 20 minutes) writing uses different electronics than normal memory writes errors can be corrected by erasing and starting over more expensive than PROM
EEPROM - Electrically Erasable Programmable Read Only Memory byte-level writing - any part(s) of the memory can be written at any time updateable in place - writing uses ordinary bus control, address, and data lines writing takes much longer than reading more expensive (per bit) and less dense than EPROM
Cache Memory Is a small, fast memory located close to the CPU that holds the most recently accessed code or data It is capable of keeping up with the CPU It act as a buffer between the CPU and the slower Main Memory. ( A buffer is a temporarily storage area) Traffic to and from CPU is in the form of words Traffic between the cache and the main memory is in the form of blocks referred to as cache lines
The Cache Mapping Function Diagram
Cache operation - overview CPU requests contents of memory location Check cache for this data If present, get from cache (fast) If not present, read required block from main memory to cache Then deliver from cache to CPU Cache includes tags to identify which block of main memory is in each cache slot
Registers Registers are at top of the memory hierarchy. They serve two functions: User-Visible Registers - enable the machine- or assembly-language programmer to minimize main-memory references by optimizing use of registers Control and Status Registers - used by the control unit to control the operation of the CPU and by privileged, OS programs to control the execution of programs
User-Visible Registers Categories of Use General Purpose Data Address Condition Codes
Control and Status Registers Program Counter (PC): holds the address of the instruction to be fetched. Instruction Register (IR): holds the last instruction fetched. Memory Address Register (MAR): holds the address of a memory location that is to be read or written. Memory Buffer Register (MBR): holds the data to be written to memory or the data most recently read. Program Status Word (PSW): Condition Code Flags + other bits defining the status of the CPU (interrupt enabled/ disabled, supervisor, etc.)
Register Organization
Limitation of primary storage Limited capacity because the cost per bit of storage is high. Volatile- the data in it is lost when the power is turned off or interrupted.
Secondary Storage Large quantities of information can be stored permanently, although they can be erased when desired Used for long term storage of information that is not in use, e. g. it holds programs, files of data and files of information Employs storage on magnetic media such as magnetic tapes, magnetic disks and magnetic drums. Examples are: Magnetic Disks Magnetic Tapes Hard Disks Floppy Diskette Compact Disks (CDs)
Types of External memories Magnetic Disk Hard Disk Optical CD – Compact Disk Magnetic Tape
Magnetic Disks Consists of a collection of platters (1-20), rotating on a spindle Platters are metal disks covered with magnetic recording materials on both sides. The disk surface is divided into concentric circles designated tracks, typically 500-2500 tracks on each Each track is divided into sectors that contains information: 64 sectors per track A sector is the smallest unit that can be read or written All tracks have the same number of sectors
The movable arm contain a READ/WRITE head which either reads or writes information in a sector. The arm of each surface are connected together and move in conjunction, so that every arm is over the same track of every surface.
Magnetic disks
Hard disk Use thicker, metallic platters for storage Faster than a floppy diskette Large capacity Sensitive instruments
Optical Disks Compact Permanent storage Two common types CD DVD
Compact Disc Optical format From 650 MB to 1 GB capacity Rotation speeds vary Types Read only: CD-ROM Write once: CD-R Rewriteable: CD-RW
Digital Versatile Disc Digital Versatile Disk or Digital Video Disk (DVD) Similar to CDs, but can store more data Types Read only Write once Rewritable
What is the difference between internal and external hard disks? Internal hard disks are located inside your main computer unit, while external hard disks are joined to the main computer unit via a lead which you plug into the back of your computer unit. Some external hard disks will plug into the USB port (connector) located at the back of your computer. Other external hard disks require the installation of a special card within your computer which allows the connection of the external hard disk to the computer unit.
Measuring Memory Basic Units of Data Storage: It is important to realise that the term digital computer refers to the fact that ultimately the computer works in what is called binary. Humans work in tens (because we have 10 fingers). To use the jargon humans work in base 10. A digital computer uses the numbers 0 and 1 (or on and off if you prefer). When we talk about computer storage, either the amount of memory (RAM) or the hard disk capacity we are talking about numbers which are multiples of 0 or 1.
Bit: All computers work on a binary numbering system, i. e Bit: All computers work on a binary numbering system, i.e. they process data in ones or zeros. This 1 or 0 level of storage is called a bit. Often hardware is specified as a 32- bit computer, which means that the hardware can process 32 bits at a time. Software is also described as 16 bit, 32 bit or 64 bit software. Byte: A byte consists of eight bits.
Kilobyte: A kilobyte (KB) consists of 1024 bytes. Megabyte: A megabyte (MB) consists of 1024 kilobytes, approximately 1,000,000 bytes. Gigabyte: A gigabyte (GB) consists of 1024 megabytes, approximately 1,000,000,000 bytes. Terabyte: A terabyte (TB) consists of approximately 1,000,000,000,000 bytes.
Files: Data and programs are stored on your disk as files. There are different types of files, such as the files in which you store your data, the files which contain your programs and also files used to store your operating system (such as Microsoft Windows).
Directories (folders): Directories or folders are used to group files with a similar theme together. For example, you could have a folder called “Accounts” containing all your accounting related files, or a folder called “Customers” containing correspondence with your customers. Folders can also contain sub-folders to further divide files. The uppermost level folder is often referred to as the “root” folder (or directory). Sometimes you may see a diagrammatic representation of folders, as illustrated below.
Records: A record is a collection of data held within a file. It is the sort of storage unit used by a database.
Reading assignment What is the difference between primary storage and secondary storage? What kinds of floppy disks are available? What is the C drive of a computer? What is the difference between a CD and a DVD?