360 likes | 373 Views
Learn about bits, bytes, storage categories, magnetic & optical storage, unit sizes, memory vs storage, hard drives, working mechanisms, advantages, and disadvantages.
E N D
Cairo University FCI 2014 File Organization & processing CS 215 Lecture 6 Storage Devices By: m_el_ramly@yahoo.ca Presenter: Dr. Mohamamd El-Ramly Many slides by Others
Content • Bits and Bytes • Storage Categories • Magnetic Storage • Optical Storage • Advanced Storage Systems
0 1 1 1 0 0 0 1 is a byte Bits & Bytes • Data consists of bits and bytes. • A bit is the smallest unit of data. The word bit comes from Binary Digit. • A bit is represented by a 0 or 1. (The 1 actually represents a small flow of current, and the 0 represents the absence of current). • A byte is eight bits stuck together in a chunk, one after the other, e.g. • Numbers that consist of just ‘0’s and ‘1’s are called binary numbers.
Bits & Bytes • As computers can only understand numbers, letters are stored and transmitted as numbers. • Each letter is stored and transmitted as a single unique byte, called its ASCII code. • ASCII stands for American Standard Code for Information Interchange. • The ASCII code for the letter A is 65, but this is stored as a single byte of binary numbers… 0 1 0 0 0 0 0 1 • When you press the ‘A’ key on a keyboard, it is this series of ‘0’s and ‘1’s that is sent to the computer. The computer recognises the series of ‘0’s and ‘1’s and displays the letter ‘A’.
Units of Data • Units of data increase by a factor of a thousand. (Actually 1024, but 1000 is used for simplicity) • A bit is a 0 or 1 • A byte is eight bits • A kilobyte is a thousand bytes (1000) • A megabyte is a million bytes (1000,000) • A gigabyte is a billion bytes (1,000,000,000) • A terabyte is a trillion bytes (1,000,000,000,000)
Units of Data • Units of data increase by a factor of a thousand. (Actually 1024, but 1000 is used for simplicity) • A terabyte is a trillion bytes (1,000,000,000,000) • A petabyte is (1,000,000,000,000,000) bytes • A exabyte is (1,000,000,000,000,000,000) bytes • A zettabyte is (1,000,000,000,000,000,000,000) bytes
Memory or Storage? • Storage can be permanent or temporary. • Data in permanentstorage is retained after thecomputer is switched off, whereas data in temporary storage is lost when the computer is switched off. • Temporary storage is called memory - this is RAM. Typical RAM size is about 2Gb, but some of the latest motherboards can hold 8, 16 or even 32Gb. • Permanent storage is often called backing storage or just storage - the most common form is a hard drive. Hard drive capacity varies from around 500GB to 16 terabyte. This presentation is about storage devices, such as hard drives.
Storage Devices • Backing storage is the permanent store of data on an internal hard drive, external hard drive, CD or DVD, memory stick, Zip disc, floppy disc, etc. Hard Drive USB Memory Stick SSD Disc Floppy Disc CD, DVD
Hard Drive • There is a hard drive in every computer – it is the main storage device. The hard drive is the entire device which contains the hard disc, but the two terms are used to mean the same thing. • A hard disc consistsof a collection of metal platters that have a magnetic coating on them. • The platters spin very quickly.
Hard Drive Head Hard Disc Sectors • This is just one platter. A hard drive will have many double-sided platters, each with a head which can read the top and bottom of the disc.
How a Hard Drive Works • When you open a file, you tell the operating system to access the file from the disc. • The operating system sendsa message to the hard drive controller to collect the file from the disc.
How a Hard Drive Works • The file may be spread over many different ‘sectors’ • The disc head collects all the pieces together and puts them together asone file. • The actual speed of a hard disc is many times faster than speed 3.
Hard Drive: Advantages • Hard drives have a large storage capacity. • They are cheap and reliable. • Very quick at writing and reading data. Hard Drive: Disadvantages • They can fail without warning, resulting in the lossof the data on the disc. (This shows the importanceof backing up). • Much slower than RAM, although for most home computing, this is not a problem.
Magnetic Disks • Bits of data (0’s and 1’s) are stored on circular magnetic platters called disks. • A disk rotates rapidly (& never stops). • A disk headreads and writes bits of data as they pass under the head. • Often, several platters are organized into a disk pack (or disk drive).
Spindle A Disk Drive surfaces Boom Read/Write heads Disk drive with 4 platters and 8 surfaces and 8 RW heads
Looking at a surface tracks sector Surface of disk showing tracks and sectors
Organization of Disks • Disk contains concentric tracks. • Tracks are divided into sectors • A sector is the smallest addressable unit in a disk.
Spindle Tracks Disk head • The platters spin (say, 90rps). • The arm assembly is moved in or out to position a head on a desired track. Tracks under heads make a cylinder (imaginary!). Sector Platters Arm movement • Only one head reads/writes at any one time. Arm assembly • Block sizeis a multiple of sector size(which is often fixed). Components of a Disk
Disk Controller • Disk controllers: typically embedded in the disk drive, which acts as an interface between the CPU and the disk hardware. • The controller has an internal cache (typically a number of MBs) that it uses to buffer data for read/write requests.
Accessing Data • When a program reads a byte from the disk, the operating system locates the surface, track and sector containing that byte, and reads the entire sector into a special area in main memory called buffer. • The bottleneck of a disk access is moving the read/write arm. • So it makes sense to store a file in tracks that are below/above each other on different surfaces, rather than in several tracks on the same surface.
Cylinders • A cylinder is the set of tracks at a given radius of a disk pack. • i.e. a cylinder is the set of tracks that can be accessed without moving the disk arm. • All the information on a cylinder can be accessed without moving the read/write arm.
Estimating Capacities • Track capacity = # of sectors/track * bytes/sector • Cylinder capacity = # of tracks/cylinder * track capacity • Drive capacity = # of cylinders * cylinder capacity • Number of cylinders = # of tracks in a surface
Exercise • Store a file of 20000 records on a disk with the following characteristics: # of bytes per sector = 512 # of sectors per track = 40 # of tracks per cylinder = 11 # of cylinders = 1331 Q1. How many cylinders does the file require if each data record requires 256 bytes? Q2. What is the total capacity of the disk?
Clusters • Usually File manager, under the operating system, maintains the logical view of a file. • File manager views the file as a series of clusters, each of a number of sectors. The clusters are ordered by their logical order. • Files can be seen in the form of logical sectors or blocks, which needs to be mapped to physical clusters. • File manager uses a file allocation table (FAT) to map logical sectors of the file to the physical clusters.
Extents • If there is a lot of room on a disk, it may be possible to make a file consist entirely of contiguous clusters. Then we say that the file is one. (very good for sequential processing) extent • If there isn’t enough contiguous space available to contain an entire file, the file is divided into two or more noncontiguous parts. Each part is a separate extent.
Internal Fragmentation • Internal fragmentation: loss of space within a sector or a cluster. • Due to records not fitting exactly in a sector:e.g. Sector size is 512 and record size is 300 bytes. Either • store one record per sector, or • allow records span sectors… • Due to the use of clusters: If the file size is not a multiple of the cluster size, then the last cluster will be partially used.
Choice of cluster size • Some operating systems allow system administrator to choose cluster size. • When to use large cluster size? • What about small cluster size?
Non-data Overhead • Both blocks and sectors require non-data overhead (written during formatting) • On sector addressable disks, this information involves sector address, track address, and condition (usable/defective). Also pre-formatting involves placing gaps and synchronization marks between the sectors.
The Cost of a Disk Access • The time to access a sector in a track on a surface is divided into 3 components: