I/O Hardwares. Some typical device, network, and data base rates

Similar documents
Chap. 3. Input/Output

I/O Devices. Chapter 5 Input/Output. Memory-Mapped I/O (2) Memory-Mapped I/O (1) Interrupts Revisited. Direct Memory Access (DMA) 11/26/2013

Chapter 5 Input/Output

Input/Output. Chapter 5: I/O Systems. How fast is I/O hardware? Device controllers. Memory-mapped I/O. How is memory-mapped I/O done?

CSE 380 Computer Operating Systems

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

CS510 Operating System Foundations. Jonathan Walpole

OPERATING SYSTEMS CS136

CSE380 - Operating Systems. Communicating with Devices

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College

Lecture 21 Disk Devices and Timers

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University

CSCI-GA Operating Systems. I/O : Disk Scheduling and RAID. Hubertus Franke

Chapter 5. Input / Output

Operating Systems 2010/2011

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. (done)

Chapter 13: Mass-Storage Systems. Disk Scheduling. Disk Scheduling (Cont.) Disk Structure FCFS. Moving-Head Disk Mechanism

Chapter 13: Mass-Storage Systems. Disk Structure

Part IV I/O System. Chapter 12: Mass Storage Structure

Disk Scheduling. Based on the slides supporting the text

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management

Part IV I/O System Chapter 1 2: 12: Mass S torage Storage Structur Structur Fall 2010

I/O Design, I/O Subsystem, I/O-Handler Device Driver, Buffering, Disks, RAID January WT 2008/09

Chapter 14: Mass-Storage Systems

Disk Scheduling. Chapter 14 Based on the slides supporting the text and B.Ramamurthy s slides from Spring 2001

Tape pictures. CSE 30341: Operating Systems Principles

CSE380 - Operating Systems

Module 13: Secondary-Storage

Chapter 11. I/O Management and Disk Scheduling

Chapter 11 I/O Management and Disk Scheduling

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

Mass-Storage Structure

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006

Operating Systems. V. Input / Output

2. Which of the following resources is not one which can result in deadlocking processes? a. a disk file b. a semaphore c. the central processor (CPU)

CSE 120. Operating Systems. March 27, 2014 Lecture 17. Mass Storage. Instructor: Neil Rhodes. Wednesday, March 26, 14

Module 13: Secondary-Storage Structure

UNIT 4 Device Management

Chapter 14: Mass-Storage Systems. Disk Structure

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

CSE325 Principles of Operating Systems. Mass-Storage Systems. David P. Duggan. April 19, 2011

Operating Systems, Fall

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

Chapter 5 Input/Output. I/O Devices

Chapter 10: Mass-Storage Systems

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

V. Mass Storage Systems

Chapter 9: Peripheral Devices: Magnetic Disks

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

Silberschatz, et al. Topics based on Chapter 13

CSCI-GA Database Systems Lecture 8: Physical Schema: Storage

A track on a magnetic disk is a concentric rings where data is stored.

Input/Output. Today. Next. ! Principles of I/O hardware & software! I/O software layers! Secondary storage. ! File systems

Semiconductor Memory Types Microprocessor Design & Organisation HCA2102

I/O CANNOT BE IGNORED

Chapter 10: Mass-Storage Systems

Administrivia. CMSC 411 Computer Systems Architecture Lecture 19 Storage Systems, cont. Disks (cont.) Disks - review

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Input/Output Systems Prof. James L. Frankel Harvard University

I/O Management and Disk Scheduling. Chapter 11

Chapter 7: Mass-storage structure & I/O systems. Operating System Concepts 8 th Edition,

I/O CANNOT BE IGNORED

CS3600 SYSTEMS AND NETWORKS

Chapter 5 - Input / Output

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

CS370 Operating Systems

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

UNIT-7. Overview of Mass Storage Structure

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Secondary storage. File systems


Chapter 10: Mass-Storage Systems

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Storage Systems. Storage Systems

I/O SYSTEMS. Sunu Wibirama

Major Device Number specifies the device class, floppy disk, hard disk, terminal (selects device driver)

Chapter 11: File System Implementation. Objectives

Storage Devices for Database Systems

Input Output (IO) Management

Storage. Hwansoo Han

Lecture 23: Storage Systems. Topics: disk access, bus design, evaluation metrics, RAID (Sections )

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

RAID (Redundant Array of Inexpensive Disks)

I/O Systems and Storage Devices

Chapter 6 Storage and Other I/O Topics

Chapter 6 - External Memory

A+ Guide to Hardware: Managing, Maintaining, and Troubleshooting, 5e. Chapter 6 Supporting Hard Drives

Physical Storage Media

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

Magnetic Disk. Optical. Magnetic Tape. RAID Removable. CD-ROM CD-Recordable (CD-R) CD-R/W DVD

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

u Covered: l Management of CPU & concurrency l Management of main memory & virtual memory u Currently --- Management of I/O devices

Storage. CS 3410 Computer System Organization & Programming

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

Chapter 12: Mass-Storage

Virtual Memory. Reading. Sections 5.4, 5.5, 5.6, 5.8, 5.10 (2) Lecture notes from MKP and S. Yalamanchili

Computer System Architecture

Transcription:

Input/Output 1

I/O Hardwares Some typical device, network, and data base rates 2

Device Controllers I/O devices have components: mechanical component electronic component The electronic component is the device controller may be able to handle multiple devices Controller's tasks convert serial bit stream to block of bytes perform error correction as necessary 3

Device Driver Interface Device Interface Printer Driver Disk Driver Printer Controller Disk Controller Device interface is standard for all the I/O devices and in POSIX compliant systems it consists of Open(), Close(), Read(), Write(), Seek(), and Control() functions. Drivers implement the device interface functions specific to a device 4

Device Management Device manager is responsible to provide services to the file manager and application software. It has a device independent infrastructure and a collection of device-dependent drivers 5

I/O Strategies I/O with polling I/O with interrupts DMA I/O 6

I/O With Polling CPU is responsible for determining if the I/O operation has completed Transferring the data between the main memory and the device controller data registers Steps for performing direct I/O with polling (for read operation) 1. Application process requests a read operation 2. The device driver queries the status register to determine if the device is idle. If the device is busy, the driver waits for it to become idle. 3. The driver stores an input command into the controllers command register, starting the device 4. The driver repeatedly reads the status register while waiting for the device to complete the operation 5. The driver copies the contents of the controller s data registers into the user s process space. 7

I/O With Interrupts Polling wastes CPU cycles. Interrupts eliminate the need for the device driver to constantly poll the controller status register Instead of polling, the device controller automatically notifies the device manager when the operation is complete. Device manager should have the following parts The driver part that initiates the operation Device status table Interrupt handler Device handler 8

I/O With Interrupts An input operation using interrupts 1. The application process requests a read operation 2. The device driver queries the status register to determine if the device is idle. If the device is busy, the driver waits for the device to become idle 3. The device driver stores an input command into the controllers command register starting the device 4. The device driver saves information regarding the operation that it began in the device status table. This table contains an entry for each device in the system. The information saved is the return address of the original call, and any special parameters for the I/O operation. 5. The device manager invokes the scheduler (so that some other process can use the CPU) and terminates 9

I/O With Interrupts 5. When the device completes the operation, it interrupts the CPU, and causes the interrupt handler to run 6. The interrupt handler determines which device caused the interrupt, and branches to the device handler for that device 7. The device handler retrieves the pending I/O status information from the device status table 8. The device handler copies the contents of the controller s data registers into the user process s space 9. The device handler returns control to the application process 10

I/O with DMA Used when the hardware has a DMA controller DMA controller has access to the system bus independent of the CPU. Contains several registers that can be written and read by the CPU The control registers specify the I/O port to use, the direction of transfer, and the unit of transfer Memory address register specifies where to write or read Byte count register specifies the amount read or written 11

Memory-Mapped I/O (1) Separate I/O and memory space Memory-mapped I/O Hybrid 12

Memory-Mapped I/O (2) (a) A single-bus architecture (b) A dual-bus memory architecture 13

Interrupts Revisited How interrupts happens. Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires 14

Disks Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD 18300 hard disk 15

Disk Hardware (2) Physical geometry of a disk with two zones A possible virtual geometry for this disk 16

Disk Hardware (5) Recording structure of a CD or CD-ROM 17

Disk Hardware (6) Logical data layout on a CD-ROM 18

Disk Hardware (7) Cross section of a CD-R disk and laser not to scale Silver CD-ROM has similar structure without dye layer with pitted aluminum layer instead of gold 19

Disk Hardware (8) A double sided, dual layer DVD disk 20

Disk Formatting (1) A disk sector 21

Disk Formatting (2) An illustration of cylinder skew 22

Disk Formatting (3) No interleaving Single interleaving Double interleaving 23

Disk Arm Scheduling Algorithms (1) Time required to read or write a disk block determined by 3 factors 1. Seek time 2. Rotational delay 3. Actual transfer time Seek time dominates Error checking is done by controllers 24

Disk Arm Scheduling Algorithms FCFS: First Come First Served Assume that the initial disk arm position is on cylinder 11 (cylinders are numbered starting from 0) If the new requests are 1, 36, 16, 34, 9, 12 (these are cylinder numbers) Then total of 10 + 35 + 20 + 18 + 25 +3 = 111 cylinders will be traversed SSF : Shortest Seek First What is the total number of cylinders traversed for the same requests, 1, 36, 16, 34, 9, 12? The arm motions of SSF is depicted in the next slide 25

Disk Arm Scheduling Algorithms (2) Initial position Pending requests Shortest Seek First (SSF) disk scheduling algorithm 26

SSF What could be the disadvantage of SSF? Elevator algorithm is proposed to overcome the disadvantages: The direction of the disk arm is important for scheduling decisions Disk arm direction going towards higher cylinder numbers is called UP, and the reverse is called DOWN After the current request was processed the next request that is closest in the direction of the disk arm is processed Assuming the disk arm direction is UP, and the requests are : 1,36,16, 34, 9, 12 then what would be the total number of cylinders traversed? 27

Disk Arm Scheduling Algorithms (3) The elevator algorithm for scheduling disk requests 28

Error Handling Metal oxide coating The linear recording density has limits (ex 5000bits/mm) High recording density means higher manufacturing errors 29

Error Handling Bad sectors result from manufacturing defects ECC can be used to handle a few defected bits Bigger errors can be handled by Controller OS 30

Error Handling A disk track with a bad sector Substituting a spare for the bad sector Shifting all the sectors to bypass the bad one 31

Error Handling Errors may occur during the normal operation of the disk which may be Transient (dust etc) Can be fixed by the ECC Repeated errors: spare sectors should be used before the sector dies completely 32

Error Handling OS can handle bad sectors by re-mapping tables Read the entire disk to construct a list of bad sectors Both allocated and free blocks need to be tested Backup system should also consider bad sectors Seek errors may also occur if the disk head can not be positioned in the right track The disk dead needs to be recalibrated when such an error occurs 33

RAID SLED : Single Large Expensive Disk The speed of Mechanic v.s. Electronic components Parallelism in CPU proved to be effective Why not parallelism in I/O? (by Patterson et.al. 1988) RAID (Redundant Array of Inexpensive Disks) Adopted by the industry as Redundant Array of Independent Disks 34

RAID RAID is a set of disks with a single RAID controller Its aim is to improve the fault tolerance and performance with a reasonable cost The disks in RAID appear as a single disk to the OS There are six different RAID organizations (0 5) RAID level 0 : Data striping is employed, i.e., the whole disk consists of strips of size k-sectors partitioned into individual disks in round robin fashion There is no redundant data storage in this approach Is this better for requests of larger or smaller chunks of read requests? No performance gain if the requests are one sector at a time! What about reliability? 35

36

RAID There are six different RAID organizations (0 5) RAID level 1: Data striping is used. It also duplicates all the disks. 37

In the above case we have 4 primary disks and 4 backup disks Every strip is written twice! Either of the two copies could be read! 38

How do you think the read and write performance is in RAID level 1? Is it fault tolerant? 39

How do you think the read and write performance is in RAID level 1? Is it fault tolerant? Write performance is the same Read performance can be twice as good Fault tolerance is excellent Recovery is easy, buy a new drive, and replace it with the one that crashed 40

RAID There are six different RAID organizations (0 5) RAID level 2: Works in very small granularity striping with hamming code for error detection and correction. For example a byte is divided into 4bit chunks, and 3 parity bits are added to form a 7 bit word which is partitioned bit by bit to 7 disks. Disk drives must be synchronized for read and write. 41

RAID level 2: Works in very small granularity striping with hamming code for error detection and correction. For example a byte is divided into 4bit chunks, and 3 parity bits are added to form a 7 bit word which is partitioned bit by bit to 7 disks. Disk drives must be synchronized for read and write. 42

RAID RAID organizations cont d (0 5) RAID level 3 : simplified version of level 2, where only checksum is stored. It can do error detection but not error correction in case there are random bit errors. What would be the effect of a single disk crash? RAID level 4: use data striping. With a strip of k bytes, an extra disk drive stores k-byte long parities constructed by performing an exclusive or on the strips in each disk. RAID level 5: It is like RAID level 4, but parity bits are distributed over the RAID disks to reduce the risk induced by parity disk crash. 43

RAID RAID organizations cont d (0 5) RAID level 3 : simplified version of level 2, where only checksum is stored. It can do error detection but not error correction in case there are random bit errors. What would be the effect of a single disk crash? Assume that one of the drives crashes, can we do Error detection Error correction! 44

Disk Hardware (4) Raid levels 3 through 5 Backup and parity drives are shaded 45

Stable Storage RAID deals with correct reads and fault tolerance against crashes How about writes? Desired Property: When a write is issued, the disk either correctly writes the data or it does nothing at all (Called Stable Storage) 46

Stable Storage Following can be handled: A written sector can suddenly become unreadable CPU can fail leading to incorrect data Following can not be handled: Student drops the computer out of the window of a skyscraper Student sets the computer room on fire Natural disasters 47

Stable Storage Stable storage uses a pair of identical disks with the corresponding blocks form an error-free block Stable write: Write the block on drive 1 Read it back and verify it, if not correct repeat the operation After n consecutive failures the block is remapped to a spare one and the operation continues After the write to drive 1 succeeds, the corresponding block on drive 2 is written and re-read until it succeeds After the stable write completes, the block is successfully written to both drives 48

Stable Storage Stable storage uses a pair of identical disks with the corresponding blocks form an error-free block Stable read: First read from drive 1 If the ECC indicates and error, then reread If after n iterations, the error occurs, then the corresponding block is read from drive 2 Assumption: probability that the same block in both drives will go bad is practically 0 49

Crash recovery Stable Storage Scan both disks and compare the corresponding blocks If one of the has ECC error, then the good one is written over the bad one If both have ECC good, but they are different, then the block in drive 1 is overwritten to drive 2. 50

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

Clock Hardware A programmable clock Generates a CPU interrupt when the counter is 0 These are called clock ticks Can be programmed to occur very 2 nsecs to 8.6 secs Computers also have battery-powered to recover the current time when the computer is turned on Original starting time for windows is 12 AM Jan 1, 1980. For Unix, it is 12 AM, Jan 1 1970. 52

Clock drivers job: Maintain time of day Clock Software Prevent processes from running longer than they are allowed to Accounting CPU usage Providing watchdog timers etc 53

Clock Software (1) Three ways to maintain the time of day 54

Simulating multiple virtual clocks Maintain a table The signal times for all pending timers stored in the table Whenever the time of day is updated, the driver checks to see if the closest signal has occured 55

Clock Software (2) Simulating multiple timers with a single clock Pending signals are for 4203, 4207, 4213, 4215, 4216 56

ALS Assume that the initial disk arm position is on cylinder 11 (cylinders are numbered starting from 0) If the new requests are 1, 36, 16, 34, 9, 12 (these are cylinder numbers) Total number of tracks traversed by SSF? Elevator? 57

Character Oriented Terminals RS-232 Terminal Hardware An RS-232 terminal communicates with computer 1 bit at a time Called a serial line bits go out in series, 1 bit at a time Windows uses COM1 and COM2 ports, first to serial lines Computer and terminal are completely independent 58

Input Software (1) Central buffer pool Dedicated buffer for each terminal 59

Input Software (2) Characters handled specially in canonical mode 60

Output Software The ANSI escape sequences accepted by terminal driver on output ESC is ASCII character (0x1B) n,m, and s are optional numeric parameters 61

Display Hardware (1) Parallel port Memory-mapped displays driver writes directly into display's video RAM 62

Display Hardware (2) A video RAM image simple monochrome display character mode Corresponding screen the xs are attribute bytes 63

Input Software Keyboard driver delivers a number driver converts to characters uses a ASCII table Exceptions, adaptations needed for other languages many OS provide for loadable keymaps or code pages 64

Output Software for Windows (1) Sample window located at (200,100) on XGA display 65

Output Software for Windows (2) Skeleton of a Windows main program (part 1) 66

Output Software for Windows (3) Skeleton of a Windows main program (part 2) 67

Output Software for Windows (4) An example rectangle drawn using Rectangle 68

Output Software for Windows (5) Copying bitmaps using BitBlt. before after 69

Output Software for Windows (6) Examples of character outlines at different point sizes 70

Network Terminals X Windows (1) Clients and servers in the M.I.T. X Window System 71

X Windows (2) Skeleton of an X Windows application program 72

The SLIM Network Terminal (1) The architecture of the SLIM terminal system 73

The SLIM Network Terminal (2) Messages used in the SLIM protocol from the server to the terminals 74

Power Management (1) Power consumption of various parts of a laptop computer 75

Power management (2) The use of zones for backlighting the display 76

Power Management (3) Running at full clock speed Cutting voltage by two cuts clock speed by two, cuts power by four 77

Power Management (4) Telling the programs to use less energy may mean poorer user experience Examples change from color output to black and white speech recognition reduces vocabulary less resolution or detail in an image 78