Escolar Documentos
Profissional Documentos
Cultura Documentos
6.1 Introduction
Introduction
Behavior: input, output, storage, network Partner: human or machine Data rate: bytes/sec, transfers/sec
Outline
Storage
Disk Flash
Interconnecting Components and I/O bus File System & Web Benchmarks I/O System Design
Chapter 6 Storage and Other I/O Topics 3
Dependability is important
Particularly for storage devices Latency (response time) Throughput (bandwidth) Desktops & embedded systems
Performance measures
Servers
Dependability
Restoration repair
Failure
Failure rate l
Dependability Measures
Reliability R(t): Probability to the first failure in a given time period MTTF: Mean Time To Failure = R(t)dt
0
Service interruption: mean time to repair (MTTR) Mean time between failures
Increase MTTF: fault avoidance, tolerance, forecasting Reduce MTTR: improved tools and processes for diagnosis and repair
Disk Storage
Nonvolatile, rotating magnetic storage
Sector
Sector ID Data (512 bytes, 4096 bytes proposed) Error correcting code (ECC)
Queuing delay if other accesses are pending Seek: move the heads to select tracks Disk rotational latency to select sector Data transfer time to read the sector Controller overhead
Sectors
Disk
Tracks
Platters
Given
512B sector, 15,000rpm, 4ms average seek time, 100MB/s transfer rate, 0.2ms controller overhead, idle disk (no waiting queue) seek time = 4ms avg rotational latency = / (15,000/60) = 2ms data transfer time 512 / 100MB/s = 0.005ms controller delay = 0.2ms Total = 6.2ms
Based on all possible seeks Locality and OS scheduling lead to smaller actual average seek times: there are many patented algorithms of reducing seek time!
Present logical (standard) sector interface to host SCSI, ATA, SATA Pre-fetch sectors in anticipation of access Avoid seek and rotational delay
Flash Storage
100 1000 faster than disk Smaller, lower power, more robust But more $/GB (between disk and DRAM)
Random read/write access Used for instruction memory in embedded systems Denser (bits/area), but block-at-a-time access Cheaper per GB Used for USB keys, media storage, Not suitable for direct RAM or disk replacement Wear leveling: remap data to less used blocks
Outline
Storage Interconnecting Components and I/O bus IO Management File System & Web Benchmarks I/O System Design
Interconnecting Components
Parallel set of wires for data, address, controls Wires are shared in different time slots One component can send at one time; All components will receive the data (broadcasting). If the destination address is different, discard data. Collision will occur if two components send at the same time; Then, resend. Coordination among control and data lines necessary Can become a bottleneck
Wire length, number of components connected
Bus Types
Synchronous Buses: Short, high speed, clocked, taking an action in each clock Processor-memory bus Graphic bus
Asynchronous Buses: Longer, slower, and allowing multiple devices, using handshaking
CPU
SRAM
Synchronous Bus
DRAM
Asynchronous Bus
...
ProcessMemory Bus
FSB
L2 Cache
Synchronous Bus
Disk CD Keyboard
Asynchronous Bus
Mouse
Data lines
Carry address and data Multiplexed (shared) or separate Indicate data type, synchronize transactions Uses a bus clock Use for fast devices Uses request/acknowledge control lines for handshaking Use for slow speed devices
Control lines
Address
Data Write
Clock
Address
Clock
week1
week2 week3 week4 week5 week6 week7 week8 week9 week10
Prepare assignment
Assignment 1 release Prepare assignment Assignment 2 release Prepare assignment Assignment 3 release Prepare assignment Assignment 4 release Prepare assignment Assignment 5 release Do assignment 1 Assignment 1 submission Do assignment 2 Assignment 2 submission Do assignment 3 Assignment 3 submission Do assignment 4 Assignment 4 submission Do assignment 5
week11
Prepare assignment
Assignment 5 submission
week2
week7
week 9
External
127 2 0.2MB/s, 1.5MB/s, or 60MB/s Yes 5m
Internal
1 2/lane
Internal
1 4
External
4 4 300MB/s
Yes 8m
Standard
IEEE 1394
PCI-SIG
SATA-IO
INCITS TC T10
Bus Arbitration
Multiple master devices are connected to a single bus, which can start to send a message at the same time. Arbitration is needed to decide which device is going to use the bus. Bus arbitration schemes A single master (processor): All devices send requests to the processor, which decides which device will use the bus Daisy chain arbitration Centralized parallel arbitration Distributed arbitration by collision detection: Ethernet
Advantages: simple to implement high utilization of bus (no conflict overhead) extendable Disadvantages: unfairness: low priority devices may never get a chance priority is position-related unreliable (a broken device can block other devices)
Advantages: a broken device can not block other devices can design flexible priorities high utilization of bus (no conflict overhead) disadvantages: not easy to extend once the design is completed vulnerable for single-point-of-failure (arbiter)
Distributed Arbitration
Advantages: less vulnerable for single-point-of-failure fairness among the devices (contention protocols) extendable disadvantages: lower utilization of bus (conflict overhead)
5.
6. by nth collision, wait 0 , 1, 2, 3, ..., or 2n-1 slots;
ad hoc mode
infrastructure mode
802.11a:
802.11b radios transmit at 2.4 GHz and send data up to 11 Mbps, with distances of about 300 feet. More: 802.11c, 802.11d, 802.11e, 802.11f, 802.11g ...
IEEE 802.11 Ad Hoc Mode Devices communicate with each other directly
station
wired network
station
Outline
Storage Interconnecting Components and I/O bus I/O Management I/O Performance
I/O Management
Need protection and scheduling Same mechanism as exceptions OS provides abstractions to programs Using library functions to access I/O, e.g., system calls, which are OS functions, in MARS simulator
36
Transfers data to/from device Synchronizes operations with software Cause device to do something Indicate what the device is doing and occurrence of errors
I/O controller
Status register
Command registers
Status registers
CPU data
Data registers
Device
I/O registers are addressed in same space as memory (considered as memory locations) Address decoder distinguishes between them OS uses address translation mechanism to make them only accessible in kernel mode, not available in the user mode. Drivers are running in kernel mode! No additional I/O instructions are required Separate instructions to access I/O registers Can only be executed in kernel mode Example: x86
38
Polling with loop-waiting: while (not busy) do send data Polling with periodically checking the busy bit and possible multitasking Interrupt-driven: More efficient if requests are not frequent; less efficient if requests are frequent, I/O processor: delegating I/O from CPU
I/O controller
Status register
I/O controller
Ready for next data
Status register
CPU data
Polling
Command reg
Interruptdriven
Command reg
Device
Device
Example: Polling
CPU wants to transfer 1024 words to a device (e.g., printer)
// CPU process counter = 1024 L0 load the status register of the device test the busy bit if busy = true goto L0 // or call Sleep(500) in multitasking OS else store a word into the data register of the device set data-ready = true counter = counter - 1 CPU I/O controller if counter = 0 exit else goto L0
Status register
// Device process L1 set busy bit to false L2 test data-ready bit if data-ready = false goto L2 set busy bit to true print the data byte0, byte1, byte2, byte3 set data-ready = false goto L1
data
Data register Command reg
Printer
Which device should we use polling? Which device should we use interrupts? What about a computer science doctors office hours and a medical doctors office hours?
Sonar range sensor Touch sensor
42
CPU transfers data between memory and I/O data registers Time consuming for high-speed devices OS provides starting address in memory and package size I/O controller transfers to/from memory autonomously Controller interrupts on completion or error
43
CPU
Mem
address address address address address
dst/src dst/src dst/src dst/src dst/src
DMA
Device Device
data
I/O Processor Device . . . Device