1.1 Bits and Bit Patterns CS11102 Introduction to Computer Science Data Storage 1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representation of information as bit patterns • Bit: Binary Digit (0 or 1) • Bit Patterns are used to represent information. – Numbers – Text characters – Images – Sound – And others 0-2 Figure 2.1 CPU and main memory connected via a bus Boolean Operations • Boolean Operation: An operation that manipulates one or more true/false values • Specific operations – AND – OR – XOR (exclusive or) – NOT 0-3 0-4 Figure 1.1 The Boolean operations AND, OR, and XOR (exclusive or) As result (for an operation): • Registers hold data immediately related to the operation being executed. • Memory is used to store data and programs required in the near future. • Auxiliary memory is used to store data and programs required later. 0-5 How the CU finds instructions and Data: 1.2 Main Memory Memory: It’s called also: * Primary memory * Main storage • Internal storage * Primary storage * Main memory * Internal memory – It holds instructions and data of the program being executed. – Memory is Volatile M data is lost if the computer is turned off. – There is an address for each location in memory (sometimes called numerical designator), CPU will refer to this address to store / retrieve data. – In computer programs, symbolic addresses are used Figure 1.7 The organization of a bytesize memory cell Main Memory Cells • Cell: A unit of main memory (typically 8 bits which is one byte) – Most significant bit: the bit at the left (high-order end) of the conceptual row of bits in a memory cell – Least significant bit: the bit at the right (low-order end) of the conceptual row of bits in a memory cell 0-9 0-10 Figure 1.8 Memory cells arranged by address Main Memory Addresses • Address: A “name” that uniquely identifies one cell in the computer’s main memory – The names are actually numbers. – These numbers are assigned consecutively starting at zero. – Numbering the cells in this manner associates an order with the memory cells. 0-11 0-12 Bits, Bytes and words: 0 or 1 is called a bit (Binary digit) A group of bits is called a byte. A byte = 8 bits 210 = 1024 bytes = 1 kilobyte (KB) 210 x 210 bytes = million bytes = 1 megabytes. (MB) • 1 billions of bytes = 1 GigaByte (GB) • 1 trillion of bytes = 1 TeraByte (TB) • 1 quadrillion of bytes = 1 Petabyte (PB) • • • • RAM and ROM: There are two types of memory chips: • RAM (Random Access Memory): two categories: – SRAM (Static RAM ): • Static • Faster • No intervention from the CPU as long as power is maintained – DRAM (Dynamic RAM) and SDRAM ( Synchronous DRAM) • • • • Dynamic Must be constantly refreshed (recharged) by the CPU Used for most PC memories because its size and cost advantages SDRAM is faster than DRAM • ROM (Read Only Memory) data cannot be changed. 1.3 Mass (Secondary) Storage • Magnetic disk storage: • Floppy Disks • Hard Disks • Tape • Optical disk storage • Compact disks • DVD • Blue-ray Disks • Flash Drives • Flash Drives • Secure Digital (SD) Memory Card Magnetic disk storage: • Floppy Disks ; not in use Made of flexible Mylar and coated with iron oxide Magnetized spots on tracks on its surface Composed of tracks and sectors 3.5-inch with 1.44MB Portable High capacity drives: up to 750MB Magnetic disk storage: • Hard Disks Rigid platter coated with magnetic oxide that can be magnetized Varity of sizes Several platters can be assembled into a disk pack A Disk drive is a device that enables data to be read from/written to a disk through a read/write head on the end of an access arm The read/write head does not match the surface, otherwise data are destroyed (called head crash) • Hard Disks (HD) Removable HD are available can be 100s of GB Fast Composed of sectors and tracks A cluster is a fixed number of adjacent sectors that are treated as one unit by OS. A cylinder is track n on all platters To reduce access time; Related data are stored on the same cylinder (access arm movements are reduced) How Data Is Organized in Hard Disks (HD) • • • • Track Sector Cluster Cylinder 21 Read/Write head • the read/write heads do not touch the disk but instead “float” just off the surface. • head crash happens if the read/write touch the surface of the disk Track • The circular portion of the disk surface that passes under the read/write head – Floppy diskette has 80 tracks on each surface – Hard disk may have 1,000 or more tracks on each surface of each platter 24 Cluster Sector • Each track is divided into sectors that hold a fixed number of bytes • A fixed number of adjacent sectors that are treated as a unit of storage – Typically two to eight sectors, depending on the operating system – Typically 512 bytes per sector • Zone bit recording assigns more sectors to tracks in outer zones than those in inner zones – Uses storage space more fully Return Return Copyright © 2003 by Prentice Hall 25 26 Cylinder Disk formatting • The location of tracks and sectors is not a permanent part of a disk’s physical structure. Instead, they are marked magnetically through a process called formatting (or initializing) the disk. • The track on each surface that is beneath the read/write head at a given position of the read/write heads – When file is larger than the capacity of a single track, operating system will store it in tracks within the same cylinder => Formatting is the process of preparing the disk for writing. Return Copyright © 2003 by Prentice Hall 27 measurements to evaluate a disk performance (1) seek time (the time required to move the read/write heads from one track to another) (2) rotation delay or latency time (the time required for the desired data to rotate and to be under the read/write head over the desired track); (3) access time (the sum of seek time and rotation delay) (4) transfer rate (the rate at which data can be transferred to or from the disk). • Magnetic Tape Storage • Data is stored as extremely small magnetic spots • Tape capacity: characters per inch (CPI) or Bytes per inch (BPI) • Two heads: r/w head and erase-head • Disk cache can be used to improve the performance Secondary Storage Disks vs. Magnetic Tapes • Data on disks can be accessed directly or sequentially, but tapes are only sequential • tape systems have much longer data access times than magnetic disk systems • Optical disk storage: • Metallic material spread over the surface of a disk • Laser hits this surface to form spots that represent 0s and 1s Digital Versatile Disk (DVD) Compact Disks (CD) • CDs are disks that are 12 centimeters in diameter and consist of reflective material covered with a clear protective coating. • Information on these CDs is stored on a single track that spirals around the CD, the track on a CD spirals from the inside out • CDs usually stores up to 700 • Examples on CD drives • Short wavelength laser can read densely packed spots – DVD drive can read CD-ROMs – Capacity up to 17GB – Allows for full-length movies – Sound is better than on audio CDs – CD-ROM - drive can only read data from CDs – CD-R - drive can write to disk once – CD-RW - drive can erase and record multiple times Copyright © 2003 by Prentice Hall Blue-ray Optical Disks • Several versions of writable and rewritable DVDs exist 33 34 Secondary Storage Flash Memory • 5 times as the capacity of DVDs – Nonvolatile RAM – Flash chips are used in cellular phones, digital cameras, .. – Requires less power and smaller that disk drives – Examples on flash memory Flash Drives Secure Digital (SD) Memory Card (up to two GBs of storage) SDHC (High Capacity) memory cards (up to 32 GBs) the next generation SDXC (Extended Capacity) may exceed a TB. Organizing data in Mass Storage Files File Storage and Retrieval • Data file: • File: A unit of data stored in mass storage system A Character A Field: a group of characters A Record ( Logical record): a group of fields A File: a group of records – A typical file may consist of a complete text document, a photograph, a program, a music recording, or a collection of data. • Key field: an identifying field in a record. The value stored in a key field is called key • Database: a group of files 0-37 Physical record versus Logical record • A block of data that matches the size of a sector is called a physical record. Thus, a large file stored in mass storage will typically consist of many physical records. • Logical record corresponds to the natural data record, eg. Student record. This may have a size larger than the physical record, in which case it will take more than one physical record File Storage and Retrieval 1.4 Representation of information as bit patterns • Buffer: An area of memory used to hold data on a temporary basis, usually during the process of being transferred from one device to another. – Representing text – Representing Numeric Values – Representing Images – Representing Sound Figure 1.13 The message “Hello.” in ASCII Representing Text • Each character (letter, punctuation, etc.) is assigned a unique bit pattern. – ASCII: Uses patterns of 7-bits to represent most symbols used in written English text – ISO developed a number of 8 bit extensions to ASCII, each designed to accommodate a major language group – Unicode: Uses patterns of 16-bits to represent the major symbols used in languages world wide 0-43 0-44 Representing Numeric Values Representing Images • Binary notation: Uses bits to represent a number in base two • Limitations of computer representations of numeric values • Bit map techniques – Pixel: short for “picture element” – RGB • Vector techniques – Overflow: occurs when a value is too big to be represented – Truncation: occurs when a value cannot be represented accurately – Scalable – TrueType and PostScript 0-45 0-46 Figure 1.14 The sound wave represented by the sequence 0, 1.5, 2.0, 1.5, 2.0, 3.0, 4.0, 3.0, 0 Representing Sound • Sampling techniques – Used for high quality recordings – Records actual audio • MIDI – Used in music synthesizers – Records “musical score” 0-47 0-48 NEXT • First Exam • Data manipulation
© Copyright 2025 Paperzz