Fig 5-5 Interrupts Handling

Slides:



Advertisements
Similar presentations
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Advertisements

Hard Disks Low-level format- organizes both sides of each platter into tracks and sectors to define where items will be stored on the disk. Partitioning:
Disks Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD hard disk.
I/O Management and Disk Scheduling Chapter 11. I/O Driver OS module which controls an I/O device hides the device specifics from the above layers in the.
I/O Management and Disk Scheduling
Chapter 5 Input/Output 5.4 Disks
Faculty of Information Technology Department of Computer Science Computer Organization Chapter 7 External Memory Mohammad Sharaf.
- Dr. Kalpakis CMSC Dr. Kalpakis 1 Outline In implementing DBMS we need to answer How should the system store and manage very large amounts of data?
CS 6560: Operating Systems Design
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania Fall 2003 Lecture Note on Disk I/O.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.
1 Pertemuan 19 Disk Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5 OFFCLASS03.
RAID and Other Disk Details
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
Other Disk Details. 2 Disk Formatting After manufacturing disk has no information –Is stack of platters coated with magnetizable metal oxide Before use,
CS 333 Introduction to Operating Systems Class 16 – Secondary Storage Management Jonathan Walpole Computer Science Portland State University.
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
Based on the slides supporting the text
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 5 Disks CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
CS 333 Introduction to Operating Systems Class 16 – Secondary Storage Management Jonathan Walpole Computer Science Portland State University.
1 Disk Scheduling Chapter 14 Based on the slides supporting the text.
Disks CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Avishai Wool lecture Introduction to Systems Programming Lecture 9 Input-Output Devices.
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
1 Input/Output Chapter 3 TOPICS Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Reference: Operating Systems Design.
Operating Systems Input/Output Devices (Ch 5: )
Operating Systems COMP 4850/CISG 5550 Disks, Part II Dr. James Money.
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
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
CS4432: Database Systems II Data Storage (Better Block Organization) 1.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Storage Systems.
1 Recitation 8 Disk & File System. 2 Disk Scheduling Disks are at least four orders of magnitude slower than main memory –The performance of disk I/O.
L/O/G/O External Memory Chapter 3 (C) CS.216 Computer Architecture and Organization.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
Lecture 9 of Advanced Databases Storage and File Structure (Part II) Instructor: Mr.Ahmed Al Astal.
CSC 322 Operating Systems Concepts Lecture - 26: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
Sistem Operasi IKH311 Masukan Luaran (Input/Output)
1Fall 2008, Chapter 12 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
CE Operating Systems Lecture 20 Disk I/O. Overview of lecture In this lecture we will look at: Disk Structure Disk Scheduling Disk Management Swap-Space.
I/O Management and Disk Structure Introduction to Operating Systems: Module 14.
Disks Chapter 5 Thursday, April 5, Today’s Schedule Input/Output – Disks (Chapter 5.4)  Magnetic vs. Optical Disks  RAID levels and functions.
Chapter 12 – Mass Storage Structures (Pgs )
ITEC 502 컴퓨터 시스템 및 실습 Chapter 9-2: Disk Scheduling Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
ITEC 502 컴퓨터 시스템 및 실습 Chapter 9-1: Disk Scheduling Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
1 Lecture 27: Disks Today’s topics:  Disk basics  RAID  Research topics.
Device Management Mark Stanovich Operating Systems COP 4610.
CS399 New Beginnings Jonathan Walpole. Disk Technology & Secondary Storage Management.
Part IV I/O System Chapter 12: Mass Storage Structure.
Disks. ●Circular-shaped storage medium ●Two main types: Magnetic and Optical ●Random access to memory ●The hardware must be controlled by driver software.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems DISK I/0.
Multiple Platters.
Disks and RAID.
I/O System Chapter 5 Designed by .VAS.
Operating System I/O System Monday, August 11, 2008.
Chapter 14 Based on the slides supporting the text
Disks.
CS510 Operating System Foundations
Overview Continuation from Monday (File system implementation)
Jonathan Walpole Computer Science Portland State University
Disks and scheduling algorithms
CS333 Intro to Operating Systems
Hard disk basics Prof:R.CHARLES SILVESTER JOE Departmet of Electronics St.Joseph’s College,Trichy.
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Disks Magnetic (hard) Disk arrays are used for reliable storage (RAID)
Presentation transcript:

Fig 5-5 Interrupts Handling Review Bus Fig 5-5 Interrupts Handling

Fig 5-11 Logical Position of Device Drivers Review Fig 5-11 Logical Position of Device Drivers

Figure 5-16 Layers of I/O Systems Review Figure 5-16 Layers of I/O Systems

Review Figure 5-4: Operation of a DMA transfer, the DMA controller has access to the system bus independent of the CPU

5.4 Disk Hardware Disks are characterized by the fact that reads and writes are equally fast, ideal for secondary memory. Arrays of disks are used to provide highly-reliable storage. Optical disks are important for distribution of programs, data, and movies.

Magnetic Disks Some magnetic disks have little electronics and just deliver a simple serial bit stream. On these disks, the controller does most of the work. On other disks, particularly IDE (Integrated Drive Electronics) disks, the drive itself contains a microcontroller that does some work and allows the real controller to issue high-level commands. Overlapped seeks: A controller does seeks on two or more drives at the same time. Many controller can read and write on one drive while seeking on one or more other drives. However, only one transfer between the controller and the main memory is possible.

Magnetic Disks Disk parameters for the original IBM PC floppy disk and a Western Digital WD 18300 hard disk

Structure of a Disc Drive

Disk Hardware 32 sectors per track 16 sectors per track A possible virtual geometry for this disk. Mapping from virtual to real parameters is needed. Physical geometry of a disk with two zones (in 18G hard disc (WD18300), there are 162 zones)

RAID (Redundant Array of Independent Disks) Distributing data over multiple drives is called striping. Disk mirroring 4bit data, 3bit Hamming code for error correction Raid levels 0 through 2 (note: no hierarchy among levels) Backup and parity drives are shaded

RAID RAID level 0 works best with large requests, the bigger the better. RAID level 0 works worst with OS that habitually ask for one sector at a time. The reliability of RAID level 0 is potentially worse than SLED (Single Large Expensive Disk). RAID level 1 duplicates all the disks. Write performance is no better, but read performance can be up to twice as good RAID level 2 works on a word basis, even a byte basis. Parity bits of a Hamming code are bits 1, 2, and 4. Imagine the seven drives of Fig 5-19(c) were synchronized on arm position and rotation position. This only makes sense with a substantial number of drives. (high overhead) Why?

RAID Raid levels 3 through 5 Backup and parity drives are shaded even or odd parity for 1 bit error correction Like RAID 0, with strip-for-strip parity written to an extra drive. Raid levels 3 through 5 Backup and parity drives are shaded

RAID RAID level 3 is a simplified version of RAID level 2. RAID levels 4 and 5 work with strips again, not individual words with parity, and do not require synchronized drives. RAID level 4 performs poorly for small updates. If one sector is changed, it is necessary to read all the drives to recalculate the parity. Slight improvement can be obtained by reading the old user data and old parity data and recompute the new parity from them. Heavy load on the parity drive. RAID level 5 distributes the parity bits uniformly over all the drives. However, in the event of a drive crash, reconstructing the contents of the failed drive is complex. Skip CD-ROMS, .. From p 310 to 315

Disk Formatting Before the disk can be used, each platter must receive a low-level format. The format consists of a series of concentric tracks, each containing some Number of sectors, with short gaps between the sectors. Start of sector bit pattern (to recognize the start of the sector), Cylinder number, Sector number Error correcting code, about 16 bytes A disk sector after low–level format. With the overhead of preamble, ECC, intersector gap, spare sectors, often the formatted capacity is 20% less than the unformatted capacity.

Disk Formatting An illustration of cylinder skew, meaning the position of sector 0 on each track is offset from the previous track to accommodate rotation latency

Cylinder skew example For a 10,000 rpm (rotations per minute) drive, one rotation takes sec If a track contains 300 sectors, a new sector passes under the head every If track to track seek time is 800 μsec , then the disk needs a cylinder skew of Data rate

Disk Formatting To allow time for ECC calculation and transferring data to main memory: (b) Single interleaving (c) Double interleaving (a) No interleaving In many modern controllers, to avoid the need for interleaving, the controller buffers an entire track.

Partition Sector 0: (master boot record) containing some boot code plus the partition table at the end, which gives the starting sector and size of each partition. To be able to boot from the hard disk, one partition must be marked as active in the partition table. High-level format of each partition: lays down a boot block, the free storage administration (free list or bitmap), root directory, and an empty file system. It also puts a code in the partition table entry telling which file system is used in the partition.

Disk Arm Scheduling Algorithms Time required to read or write a disk block determined by 3 factors Seek time Rotational delay Actual transfer time Seek time dominates Error checking is done by controllers Many disk drivers maintain a table, indexed by cylinder number, with all the pending requests for each cylinder chained together in a linked list headed by the table entries.

Disk Arm Scheduling Algorithms First Come First Served: With initial position at 11, pending requests at 1, 36, 16, 34, 9, 12, total arm motions are 111 cylinders Initial position Pending requests (2) Shortest Seek First (SSF) disk scheduling algorithm: totally 61 cylinders With a heavily loaded disk, the arm will tend to stay in the middle of the disk most of the time. Not fair.

Disk Arm Scheduling Algorithms (3) The elevator algorithm for scheduling disk requests: totally 60 cylinders. The upper bound on the total motion is fixed. (4) Variation of the elevator algorithm: always scan in the same direction to have smaller variance in response time.

Disk Arm Scheduling Algorithms If the disk has the property that the seek time is much faster than the rotation delay, then pending requests should be sorted by sector number, and as soon as the next sector is about to pass under the head, the arm should be zipped over to the right track to read/write it. Many disk controllers always read and cache multiple sectors in the controller’s cache memory, even when only one is requested. In its simplest mode, the cache is divided into two sections, one for reads and one for writes. Disk controller’s cache is independent of the OS’s cache. What is the difference? Other issues: myltiple drives, real geometry vs. virtual geometry Many are not actually read

Error Handling Bad sectors do not correctly read back the value just written to it. If the defect can not be covered by ECC, the error can not be masked. Two approaches to bad blocks: deal with them in the controller and deal with them in the OS.

Error Handling Controller handling of bad sectors (in initial shipment) A disk track with a bad sector Substituting a spare for the bad sector Shifting all the sectors to bypass the bad one

Error Handling Errors can develop after the drive is installed. If ECC cannot handle, the first thing is try the read again. If it is getting repeated errors on a certain sector, it can switch to a spare before the sector has died completely. Usually Fig5-29(b) has to be used. OS handling of bad sectors Must make sure bad sectors do not occur in any files and do not occur in any free list or bitmap. One way is done by creating a secret file containing all the bad sectors.

Error Handling Problems: Backup: If the disk is backed up sector by sector rather than file by file, it is difficult to prevent read errors during backup. The only hope is the backup program is smart enough to give up after 10 failed reads and continue with the next sector. mechanical problems: When the arm gets to its destination, the controller reads the actual cylinder number from the preamble of the next sector. If the arm is in a wrong place, a seek error has occurred. Most hard disk controller correct seek error automatically. Most floppy controllers let the drive handle the error by issuing a recalibrate command, to move the arm as far as it will go and reset the controller’s internal idea of the current cylinder to 0.

Error Handling Disk usually has a pin on the chip which forces the controller to forget whatever it was doing and reset itself. If all else failed, the disk driver can set a bit to invoke this signal and reset the controller. In systems with real-time constraints, like video or CD-ROM recording, recalibration inserts gaps into the bit stream and are unacceptable. Special drives, which never recalibrate are available for such applications.

Stable Storage Stable storage: When a write is issued, the disk either correctly writes the data, or it does nothing, leaving the existing data intact. Basic Assumption When a disk writes a block with error, the error could be detected on a subsequent read by examining ECC. Having the same sector go bad on a second (independent) drive during a reasonable time interval is small enough to ignore. CPU can fail, in which case it just stops.

Stable Storage Uses a pair of identical disks with the corresponding blocks working together to form one error-free block. In the absence of errors, the corresponding blocks on both drives are the same. The following three operations are defined: Stable writes: first writing the block on drive 1, the reading it back to verify. If not correctly, retry up to n times until one works. After n consecutive failures, try a spare sector until it succeeds. After the write to disk 1 has succeeded, the corresponding disk on drive 2 is written in the same way.

Stable Storage Stable reads: First read from drive 1. If failed with an incorrect ECC, the read is tried again, up to n times. If all failed, the corresponding block is read from drive 2. Crash recovery: If a pair of blocks are both good and the same, nothing needs to be done. If one of them has an ECC error, the bad block is overwritten by the other good block. If both are good but different, the block from drive 1 is written onto drive 2.

Analysis of the influence of crashes on stable writes Stable Storage Analysis of the influence of crashes on stable writes

Stable Storage Improvements: Keep track of which block was being written in nonvolatile RAM during a stable write so that only one block has to be checked during recovery. The stable write can put the number of the block it is about to update in nonvolatile RAM before starting the write. If nonvolatile RAM is not available, at the start of the stable write, a fixed disk block on drive 1 is overwritten with the number of the block to be stably written. This block is then read back to verify it. After getting it correct, the corresponding block on drive 2 is written and verified. Once a day, a complete scan of both disks must be done repairing any damage. Then even if both blocks go bad within a period of a few days, all errors are repaired correctly.