University of Dublin Trinity College. Storage Hardware. Owen.Conlan@cs.tcd.ie

Similar documents
Record Storage and Primary File Organization

Chapter 13. Disk Storage, Basic File Structures, and Hashing

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 13-1

INTRODUCTION The collection of data that makes up a computerized database must be stored physically on some computer storage medium.

Chapter 13 Disk Storage, Basic File Structures, and Hashing.

Chapter 13. Chapter Outline. Disk Storage, Basic File Structures, and Hashing

Chapter 8: Structures for Files. Truong Quynh Chi Spring- 2013

Chapter 2: Computer-System Structures. Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General System Architecture

Secondary Storage. Any modern computer system will incorporate (at least) two levels of storage: magnetic disk/optical devices/tape systems

Storage in Database Systems. CMPSCI 445 Fall 2010

Storing Data: Disks and Files

Solid State Drive Architecture

Database 2 Lecture I. Alessandro Artale

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen

Physical Data Organization

& Data Processing 2. Exercise 2: File Systems. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

Storing Data: Disks and Files. Disks and Files. Why Not Store Everything in Main Memory? Chapter 7

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

Devices and Device Controllers

Price/performance Modern Memory Hierarchy

System Architecture. CS143: Disks and Files. Magnetic disk vs SSD. Structure of a Platter CPU. Disk Controller...

6. Storage and File Structures

Operating Systems CSE 410, Spring File Management. Stephen Wagner Michigan State University

File System Management

Lecture 16: Storage Devices

Outline. CS 245: Database System Principles. Notes 02: Hardware. Hardware DBMS Data Storage

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

Data Storage - I: Memory Hierarchies & Disks

CSCA0102 IT & Business Applications. Foundation in Business Information Technology School of Engineering & Computing Sciences FTMS College Global

File System & Device Drive. Overview of Mass Storage Structure. Moving head Disk Mechanism. HDD Pictures 11/13/2014. CS341: Operating System

Chapter 3: Computer Hardware Components: CPU, Memory, and I/O

Computer-System Architecture

COS 318: Operating Systems. Storage Devices. Kai Li Computer Science Department Princeton University. (

Chapter 9: Peripheral Devices: Magnetic Disks

Introduction to I/O and Disk Management

FAT32 vs. NTFS Jason Capriotti CS384, Section 1 Winter Dr. Barnicki January 28, 2000

Types Of Storage Device

Chapter 8 Memory Units

Platter. Track. Index Mark. Disk Storage. PHY 406F - Microprocessor Interfacing Techniques

Sistemas Operativos: Input/Output Disks

CHAPTER 13: DISK STORAGE, BASIC FILE STRUCTURES, AND HASHING

4.2: Multimedia File Systems Traditional File Systems. Multimedia File Systems. Multimedia File Systems. Disk Scheduling

William Stallings Computer Organization and Architecture 7 th Edition. Chapter 6 External Memory

Chapter 1 Computer System Overview

Primary Memory. Input Units CPU (Central Processing Unit)

William Stallings Computer Organization and Architecture 8 th Edition. External Memory

Chapter 12 File Management

Obj: Sec 1.0, to describe the relationship between hardware and software HW: Read p.2 9. Do Now: Name 3 parts of the computer.

Chapter 12 File Management. Roadmap

Operating System Concepts. Operating System 資 訊 工 程 學 系 袁 賢 銘 老 師

Database Systems. Session 8 Main Theme. Physical Database Design, Query Execution Concepts and Database Programming Techniques

CHAPTER 2: HARDWARE BASICS: INSIDE THE BOX

Unit Storage Structures 1. Storage Structures. Unit 4.3

Lecture 1: Data Storage & Index

Outline: Operating Systems

Chapter 11 I/O Management and Disk Scheduling

Outline. Principles of Database Management Systems. Memory Hierarchy: Capacities and access times. CPU vs. Disk Speed

COS 318: Operating Systems. Storage Devices. Kai Li and Andy Bavier Computer Science Department Princeton University

Chapter 12 File Management

CS 153 Design of Operating Systems Spring 2015

Mass Storage Structure

Chapter 10: Storage and File Structure

Tech Application Chapter 3 STUDY GUIDE

Disks and RAID. Profs. Bracy and Van Renesse. based on slides by Prof. Sirer

Data Storage and Backup. Sanjay Goel School of Business University at Albany, SUNY

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Robert Wagner

With respect to the way of data access we can classify memories as:

An overview of FAT12

Buffer Management 5. Buffer Management

Chapter 10: Mass-Storage Systems

Communicating with devices

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

File Systems Management and Examples

Have both hardware and software. Want to hide the details from the programmer (user).

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

Classification of Physical Storage Media. Chapter 11: Storage and File Structure. Physical Storage Media (Cont.) Physical Storage Media

Computer Organization & Architecture Lecture #19

Storage and File Structure

CSCA0201 FUNDAMENTALS OF COMPUTING. Chapter 5 Storage Devices

Memory Hierarchy. Arquitectura de Computadoras. Centro de Investigación n y de Estudios Avanzados del IPN. adiaz@cinvestav.mx. MemoryHierarchy- 1

Topics in Computer System Performance and Reliability: Storage Systems!

File Management. Chapter 12

Computer Systems Structure Main Memory Organization

Handout 17. by Dr Sheikh Sharif Iqbal. Memory Unit and Read Only Memories

Lesson Plan. Preparation

An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008

Operating Systems CS-384. File Systems. NTFS and FAT32. Submitted To: Dr. Chris Taylor. Submitted By: Aditya Sitani

Chapter 12: Secondary-Storage Structure

COS 318: Operating Systems. File Layout and Directories. Topics. File System Components. Steps to Open A File

McGraw-Hill Technology Education McGraw-Hill Technology Education

Main Memory & Backing Store. Main memory backing storage devices

CS 6290 I/O and Storage. Milos Prvulovic

361 Computer Architecture Lecture 14: Cache Memory

Writing Assignment #2 due Today (5:00pm) - Post on your CSC101 webpage - Ask if you have questions! Lab #2 Today. Quiz #1 Tomorrow (Lectures 1-7)

Chapter 1 File Organization 1.0 OBJECTIVES 1.1 INTRODUCTION 1.2 STORAGE DEVICES CHARACTERISTICS

Input / Ouput devices. I/O Chapter 8. Goals & Constraints. Measures of Performance. Anatomy of a Disk Drive. Introduction - 8.1

1. Computer System Structure and Components

Chapter 7 Types of Storage. Discovering Computers Your Interactive Guide to the Digital World

Transcription:

University of Dublin Trinity College Storage Hardware Owen.Conlan@cs.tcd.ie

Hardware Issues Hard Disk/SSD CPU Cache Main Memory CD ROM/RW DVD ROM/RW Tapes Primary Storage Floppy Disk/ Memory Stick Secondary Storage

Hardware Issues Primary Storage is Limited Volatile Expensive However, it is also Fast (May be accessed directly from the CPU)

Hardware Issues Secondary Storage is Extendible Persistent Cheap However, it is Relatively slow (must be copied to main memory before being accessed by the CPU)

Why do we use secondary storage? Hardware Issues Primary storage (RAM) costs more than disk space We like to switch our computers off and on again But secondary storage is very slow Retrieving a single character from RAM takes about 150 nanoseconds (150 billionths of a second) Retrieving the same character from disk takes about 75 milliseconds (thousandths of a second) 75 msec is 500,000 times longer than 150 ns.

Disk Storage Devices Disk Storage Devices Direct Access Storage As opposed to Tape drives, which are serial devices Offer high storage capacity and low cost Data stored as magnetized areas on magnetic platters surfaces Each disk has one or more platters A disk pack contains several magnetic platters connected to a rotating spindle

Disk Pack with Read/Write H/W Actuator Arm Read/Write Head Spindle Cylinder of Tracks (imaginary) Magnetic Disk Actuator Movement Rotation

Some disks have fixed-heads Movable vs Fixed-head Disks As many read/write heads as there are tracks on the platter Track is selected electronically and is therefore much faster Cost of additional read/write heads is the limiting factor to production Disks with an actuator are called moveable-head disks Actuator moves the (single) read/write head per platter to the appropriate track

Tracks and Sectors Sector (arc of a track) Track Disks are divided into concentric circular tracks on each platter surface Track capacities vary typically from 4 to 50 Kbytes The division of the disk into sectors is hard-coded and may not be changed Subtended at fixed angle at the centre of a platter are sectors (figure above) Not all disks have their tracks divided into sectors Platter

Cylinder Tracks directly above and below one another form a cylinder All information on a cylinder can be accessed without moving the arm (called seeking) that holds the read/ write heads A cylinder consists of a group of tracks A track consists of a group of sectors A sector consists of a group of bytes

Estimating Capacities Track capacity = #sectors per track * bytes per sector Cylinder capacity = #tracks per cylinder * Track capacity Drive capacity = #cylinders * Cylinder capacity Knowing these relationships allows us to compute the amount of disk space a file is likely to require How many cylinders to store a file with 20,000 fixed length records of 256 bytes each on a disk with 512 bytes per sector 40 sectors per disk 11 tracks per cylinder

Estimating Capacities Answer The file is 20,000 * 256 = 5,120,000 bytes 5,120,000 / 512 = 10,000 sectors 10,000 / 40 = 250 tracks 250 / 11 = 22.72 cylinders If 22.72 physically contiguous cylinders are not available then the file will have to be spread out over the disk (fragmentation)

Blocks What are Blocks? A track is divided into blocks or pages Block size (generally) fixed for each operating system Typical block sizes range from 512 bytes to 4096 bytes A disk with hard-coded sectors often has the sectors further subdivided onto blocks Why are they important? Whole blocks are transferred between disk and main memory for processing

Disk I/O Input/Output (I/O) from/to a Disk A read-write head moves to the track that contains the block to be transferred (seek) Disk rotation moves the block under the read-write head for reading and writing (rotational delay or latency) Operating System finds the correct block A physical disk block address consists of a surface number, track number (within surface), and block number (within track) Entire block read/written from/to an area in RAM called a buffer Time taken to transfer the block (block transfer time) Reading or writing a disk block is time consuming because of the seek times and rotational delay Double buffering can be used to speed up the transfer of contiguous disk blocks

Buffers When several blocks need to be transferred from disk to main memory (and all the block addresses are known beforehand) several buffers can be reserved in main memory to speed the transfer CPU processes data in a buffer while another is being read/written Facilitated by independent Input/Output processor Can transfer data block to/from main memory independent of and in parallel to CPU processor This technique is referred to as double buffering

Example of Double Buffering Use of two buffers, A and B, for reading from disk Disk Block : i fill A i + 1 fill B i + 2 fill A i + 3 fill B i + 4 fill A IO Disk Block : Processing i process A i + 1 process B i + 2 process A i + 3 process B i + 4 process A Time

Physical and Logical Files A disk drive may contain many physical files A program uses these files via the operating system, but knows nothing about where the data is on disk A program sees only logical files When a program wants to access a file, the operating system provides the hook-up between logical and physical file The programmer does not need to know the physical location on disk, just the logical name creating

Sector Organisation There are two basic ways to organise data on a disk by sector organisation or user-defined block We will study only sector organisation The physical placement of sectors You cannot read a series of sectors that are all in the same track one right after another! After reading the data, it takes the machine time to process the data before retrieving more So, if logically adjacent sectors were placed physically adjacent, retrieval would be slow Solution : Interleave the sectors

Sector Organisation - Clusters A cluster is a fixed number of contiguous sectors All clusters on a disk are the same size To view a file as a series of clusters and still maintain the sectored view, the file manager ties the logical sectors to the physical clusters using a file allocation table (FAT) FAT - The FAT contains a linked list of all the clusters in a file, ordered according to the logical order of the sectors in a cluster With each entry in the FAT is an entry giving the physical location of the cluster

Review Compared to RAM disk accesses are slow, but cheap! Disks facilitate persistent storage of data Disks enable direct access Anatomy of a Disk Platters, tracks, cylinders, sectors, blocks Physical components of a Disk Magnetic disks, actuator, arm, read/write heads, spindle Estimating Capacities Disk I/O and Buffering Sector Organisation and Clustering

University of Dublin Trinity College File Basics Owen.Conlan@cs.tcd.ie

Files Data placed on secondary storage is collected into files The layout of the data in the file will have an enormous impact on how long it takes to find a particular piece of data We don t want to have to look through the whole file if we are on looking for one small piece of data We want to find the right piece of data with as few accesses to the file as possible

Logical Files Program Operating System Logical Files Physical Files Other Hardware Devices

Stream File Consider the following information Lord of the Rings, 189, Fantasy Star Wars, 210, Sci-Fi When this information is written to a (stream) file, we lose the organisation of the units of data When the file is accessed by a program its information is seen only as a string of characters Solution : Use records with field structures

Stream File wilde> od -A x -xc lotr.txt 000000 4c6f 7264 206f 6620 7468 6520 5269 6e67 L o r d o f t h e R i n g 000010 732c 2031 3839 2c20 4661 6e74 6173 790a s, 1 8 9, F a n t a s y \n 000020 od is a program which enables the user to dump file information in octal and other formats. The output above is shown as hexidecimal shorts.

Field What is a Field? A Fixed or variable number of bytes that form a data value E.g. Movie Name such as Star Wars There are many ways of adding structure to files to maintain the identity of fields, for example Choose a special character/delimiter that will not appear as a legitimate character within a field and then insert that character into the file after writing each field called delimited-text field Use a fixed length for each field (the size depending on field in question) and pad out when length of actual data value is less than the fixed length called fixed-length field Write the length of the value (in bytes) followed by the value in exactly that number of bytes called length-based field Write the name of the field and then value both represented as delimited-text fields called identified field

Record What is a Record? Fixed or variable length collections of fields E.g. Movie Record such as Star Wars, 210, SciFi A record is a set of fields that belong together when the file is viewed in terms of a higher level organisation. A record is another level of organisation that we impose on the data to preserve meaning Records do not necessarily exist in the file in any physical sense But they are an important logical notion

Records to Blocks mapping Records of a file must be allocated to disk blocks Recall, a block is the unit of data transfer between disk and memory Blocking Factor (bfr) for a file Number of records that can fit in a block when block size > record size bfr = round_down(b/r) B is block size in bytes R is actual record size in bytes for fixed length records but is the average record size in bytes for variable length records Unused portion = B (bfr*r) bytes

Spanned/Unspanned Organisation What happens in case R > B? Spanned organisation End of first block points to rest of record in an unused portion of another block Unspanned organisation Each record starts at a new block and uses next block, with unused portions not used

Files of Records A file is a sequence of records, where each record is a collection of data values (fields or data items) A file descriptor (or file header) includes information that describes the file, such as the field names and their data types, and the addresses of the file blocks on disk Records are stored on disk blocks. The blocking factor for a file is the (average) number of file records stored in a disk block The physical disk blocks that are allocated to hold the records of a file can be contiguous, linked, or indexed. In a file of fixed-length records, all records have the same format. Usually, unspanned blocking is used with such files Files of variable-length records require additional information to be stored in each record, such as separator characters and field types. Usually spanned blocking is used with such files

File Operations OPEN: Readies the file for access, and associates a pointer that refers to a current file record at each point in time FIND: Searches for the first file record that satisfies a certain condition, and makes it the current file record FINDNEXT: Searches for the next file record (from the current record) that satisfies a certain condition, and makes it the current file record

File Operations READ: Reads the current file record into a program variable INSERT: Inserts a new record into the file, and makes it the current file record DELETE: Removes the current file record from the file, usually by marking the record to indicate that it is no longer valid MODIFY: Changes the values of some fields of the current file record

CLOSE: Terminates access to the file File Operations REORGANISE: Reorganises the file records. For example, the records marked deleted are physically removed from the file or a new organisation of the file records is created. READ_ORDERED: Reads the file blocks in order of a specific field of the file

Review Operating Systems provide a logical view of physical files to Programs Stream Files Fixed and Variable Fields Delimited-text, fixed-length, length-based, identified Records (and their relationship to Blocks) bfr, spanned/unspanned Files of Records File Operations