Programmer’s View of Files Logical view of files: –An a array of bytes. –A file pointer marks the current position. Three fundamental operations: –Read.

Slides:



Advertisements
Similar presentations
Storing Data: Disk Organization and I/O
Advertisements

Secondary Storage Devices: Magnetic Disks
Overview of Mass Storage Structure
Csci 2111: Data and File Structures Week2, Lecture 1 & 2
I/O Management and Disk Scheduling
Lecture # 7. Topics Storage Techniques of Bits Storage Techniques of Bits Mass Storage Mass Storage Disk System Performance Disk System Performance File.
Storing Data: Disks and Files: Chapter 9
Problems in IO & File System CS 1550 Recitation November 4 th /6 th, 2002 The questions in this slide are from Andrew S. Tanenbaum's textbook page 375,
The Memory Hierarchy fastest, perhaps 1Mb
Storage. The Memory Hierarchy fastest, but small under a microsecond, random access, perhaps 2Gb Typically magnetic disks, magneto­ optical (erasable),
CS4432: Database Systems II Data Storage - Lecture 2 (Sections 13.1 – 13.3) Elke A. Rundensteiner.
IELM 230: File Storage and Indexes Agenda: - Physical storage of data in Relational DB’s - Indexes and other means to speed Data access - Defining indexes.
1 Storing Data: Disks and Files Yanlei Diao UMass Amherst Feb 15, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
1 Storage Hierarchy Cache Main Memory Virtual Memory File System Tertiary Storage Programs DBMS Capacity & Cost Secondary Storage.
1 CS143: Disks and Files. 2 System Architecture CPU Main Memory Disk Controller... Disk Word (1B – 64B) ~ x GB/sec Block (512B – 50KB) ~ x MB/sec System.
1 Outline File Systems Implementation How disks work How to organize data (files) on disks Data structures Placement of files on disk.
CS4432: Database Systems II Lecture 2 Timothy Sutherland.
CPSC-608 Database Systems Fall 2009 Instructor: Jianer Chen Office: HRBB 309B Phone: Notes #5.
Disks.
12/3/2004EE 42 fall 2004 lecture 391 Lecture #39: Magnetic memory storage Last lecture: –Dynamic Ram –E 2 memory This lecture: –Future memory technologies.
1 CS222: Principles of Database Management Fall 2010 Professor Chen Li Department of Computer Science University of California, Irvine Notes 01.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
1 Secondary Storage Devices. 2 Content ►Secondary storage devices ►Organization of disks ►Organizing tracks by sector ►Organizing tracks by blocks ►Non-data.
1 Introduction to Computers Day 4. 2 Storage device A functional unit into which data can be –placed –retained(stored) –retrieved(accessed)
Computer SCIENCE Data Representation and Machine Concepts Section 1.3
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
12.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 12: Mass-Storage Systems.
Disk and I/O Management
Chapter 8 File Processing and External Sorting. Primary vs. Secondary Storage Primary storage: Main memory (RAM) Secondary Storage: Peripheral devices.
CS4432: Database Systems II Data Storage (Better Block Organization) 1.
DISKS IS421. DISK  A disk consists of Read/write head, and arm  A platter is divided into Tracks and sector  The R/W heads can R/W at the same time.
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
Lecture 11: DMBS Internals
1 6 Further System Fundamentals (HL) 6.2 Magnetic Disk Storage.
Introduction to Database Systems 1 Storing Data: Disks and Files Chapter 3 “Yea, from the table of my memory I’ll wipe away all trivial fond records.”
CS 111 – Aug – 1.3 –Information arranged in memory –Types of memory –Disk properties Commitment for next day: –Read pp , In other.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 12: Mass-Storage.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
Database Management Systems,Shri Prasad Sawant. 1 Storing Data: Disks and Files Unit 1 Mr.Prasad Sawant.
External Storage Primary Storage : Main Memory (RAM). Secondary Storage: Peripheral Devices –Disk Drives –Tape Drives Secondary storage is CHEAP. Secondary.
Secondary Storage Devices: Magnetic Disks Optical Disks Floppy Disks Magnetic Tapes CENG 351.
Chapter 8 External Storage. Primary vs. Secondary Storage Primary storage: Main memory (RAM) Secondary Storage: Peripheral devices  Disk drives  Tape.
Lecture 3 Page 1 CS 111 Online Disk Drives An especially important and complex form of I/O device Still the primary method of providing stable storage.
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
Indexing CS 400/600 – Data Structures. Indexing2 Memory and Disk  Typical memory access: 30 – 60 ns  Typical disk access: 3-9 ms  Difference: 100,000.
Lecture 40: Review Session #2 Reminders –Final exam, Thursday 3:10pm Sloan 150 –Course evaluation (Blue Course Evaluation) Access through.
CS4432: Database Systems II Data Storage 1. Storage in DBMSs DBMSs manage large amounts of data How does a DBMS store and manage large amounts of data?
Storing Data Dina Said 1 1.
Disk Basics CS Introduction to Operating Systems.
CS 101 – Sept. 28 Main vs. secondary memory Examples of secondary storage –Disk (direct access) Various types Disk geometry –Flash memory (random access)
DMBS Internals I February 24 th, What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the.
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
Disk storage systems Question#1 (True/False) A track is divided into multiple units called sectors.
Disk Average Seek Time. Multi-platter Disk platter Disk read/write arm read/write head.
Magnetic Disk Rotational latency Example Find the average rotational latency if the disk rotates at 20,000 rpm.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
COSC 6340: Disks 1 Disks and Files DBMS stores information on (“hard”) disks. This has major implications for DBMS design! » READ: transfer data from disk.
1 Lecture 16: Data Storage Wednesday, November 6, 2006.
Lecture 3 Secondary Storage and System Software I
1 Components of the Virtual Memory System  Arrows indicate what happens on a lw virtual address data physical address TLB page table memory cache disk.
CS422 Principles of Database Systems Disk Access Chengyu Sun California State University, Los Angeles.
File organization Secondary Storage Devices Lec#7 Presenter: Dr Emad Nabil.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 11: File System Implementation.
Database Management Systems (CS 564)
Backing Store.
Disks and Files DBMS stores information on (“hard”) disks.
Lecture 11: DMBS Internals
Secondary Storage Management Brian Bershad
Secondary Storage Management Hank Levy
Presentation transcript:

Programmer’s View of Files Logical view of files: –An a array of bytes. –A file pointer marks the current position. Three fundamental operations: –Read bytes from current position (move file pointer) –Write bytes to current position (move file pointer) –Set file pointer to specified byte position.

Java File Functions RandomAccessFile(String name, String mode) close() read(byte[] b) write(byte[] b) seek(long pos)

Primary vs. Secondary Storage Primary storage: Main memory (RAM) Secondary Storage: Peripheral devices –Disk drives –Tape drives –Flash drives

Comparisons RAM is usually volatile. RAM is about 1/2 million times faster than disk. Medium RAM$ Disk Flash Floppy Tape

Golden Rule of File Processing Minimize the number of disk accesses! 1. Arrange information so that you get what you want with few disk accesses. 2. Arrange information to minimize future disk accesses. An organization for data on disk is often called a file structure. Disk-based space/time tradeoff: Compress information to save processing time by reducing disk accesses.

Disk Drives

Sectors A sector is the basic unit of I/O.

Terms Locality of Reference: When record is read from disk, next request is likely to come from near the same place on the disk. Cluster: Smallest unit of file allocation, usually several sectors. Extent: A group of physically contiguous clusters. Internal fragmentation: Wasted space within sector if record size does not match sector size; wasted space within cluster if file size is not a multiple of cluster size.

Seek Time Seek time: Time for I/O head to reach desired track. Largely determined by distance between I/O head and desired track. Track-to-track time: Minimum time to move from one track to an adjacent track. Average Access time: Average time to reach a track for random access.

Other Factors Rotational Delay or Latency: Time for data to rotate under I/O head. –One half of a rotation on average. –At 7200 rpm, this is 8.3/2 = 4.2ms. Transfer time: Time for data to move under the I/O head. –At 7200 rpm: Number of sectors read/Number of sectors per track * 8.3ms.

Disk Spec Example 16.8 GB disk on 10 platters = 1.68GB/platter 13,085 tracks/platter 256 sectors/track 512 bytes/sector Track-to-track seek time: 2.2 ms Average seek time: 9.5ms 4KB clusters, 32 clusters/track. 5400RPM

Disk Access Cost Example (1) Read a 1MB file divided into 2048 records of 512 bytes (1 sector) each. Assume all records are on 8 contiguous tracks. First track: (11.1)(1.5) = 26.2 ms Remaining 7 tracks: (11.1)(1.5) = 18.9ms. Total: * 18.9 = 158.5ms

Disk Access Cost Example (2) Read a 1MB file divided into 2048 records of 512 bytes (1 sector) each. Assume all file clusters are randomly spread across the disk. 256 clusters. Cluster read time is 8/256 of a rotation for about 5.9ms for both latency and read time. 256( ) is about 3942ms or nearly 4 sec.

How Much to Read? Read time for one track: (11.1)(1.5) = 26.2ms Read time for one sector: /2 + (1/256)11.1 = 15.1ms Read time for one byte: /2 = 15.05ms Nearly all disk drives read/write one sector (or more) at every I/O access –Also referred to as a page or block

More Recent Drive Specs Samsung Spinpoint T GB (nominal) 7200 RPM Track to track: 0.8 ms Average track access: 8.9 ms Bytes/sector surfaces/heads 15