Upload
leonard-ross
View
218
Download
0
Tags:
Embed Size (px)
Citation preview
Joonwon [email protected]
IO and RAID
2
Input/Output
5.1 Principles of I/O hardware5.2 Principles of I/O software5.3 I/O software layers5.4 Disks5.5 Clocks5.6 Character-oriented terminals5.7 Graphical user interfaces5.8 Network terminals5.9 Power management
3
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
– make available to main memory
4
Memory-Mapped I/O: merits
IN REG, PORTOUT PORT, REG
memory-mapped IO-all code can be written in C-test&set on control register
data buffer in memorycontrol registers are on ports
5
Memory-Mapped I/O: demerits
• cached IO registers can be disastrous
• complex bus architectures– case (b) is more difficult for MM IO
6
Direct Memory Access (DMA)
• physical or virtual address?
7
Goals of I/O Software (1)• Device independence
– programs can access any I/O device – without specifying device in advance
· (floppy, hard drive, or CD-ROM)
• Uniform naming– name of a file or device a string or an integer– not depending on which machine
• Error handling– handle as close to the hardware as possible
• synchronous vs asynchronous• buffered or not
8
Goals of I/O Software (2)
• Synchronous vs. asynchronous transfers– blocked transfers vs. interrupt-driven
• Buffering– data coming off a device cannot be stored in final
destination
• Sharable vs. dedicated devices– disks are sharable
– tape drives would not be
9
Programmed I/O
copy_from_user(buffer, p, count) /* p is the kernel buffer */for(i=0; i<count; i++) {
while(*printer_status_register != READY); /* polling */*printer_data_register = p[i];
}
10
Interrupt-Driven I/O
• syscall ends up with calling the scheduler (a)• the device raises an interrupt when it is ready• the interrupt is handled like (b)
printer
io request
interrupt
11
I/O Using DMA
• syscall (a) and interrupt handler (b)
12
I/O Software Layers
Layers of the I/O Software System
13
Interrupt Handlers (1)1. Save regs not already saved by interrupt hardware
2. Set up context(MMU) for interrupt service procedure
3. Set up stack for interrupt service procedure
4. Ack interrupt controller, reenable interrupts
5. Copy registers from where saved
6. Run service procedure
7. Set up MMU context for process to run next
8. Load new process' registers
9. Start running the new process
top half
bottom half
interrupt handler
14
Device Drivers device driver
15
Device Drivers in User Space• Advantages
– all user level utilities can be used
• libraries, debugger
– an error affects only the driver, not the whole kernel
– easy installation (dynamic and static)
• Disadvantages– interrupts are not available
– direct memory is not possible
– slow (user/kernel switching)
– usually not reentrant
16
Device-Independent I/O Software (1)
Functions of the device-independent I/O software
Uniform interfacing for device drivers
Buffering
Error reporting
Allocating and releasing dedicate devices
Providing a device-independent block size
io software
17
Device-Independent I/O Software (2)
• Standard interface eases development of device driver
• naming like a file eases protection
18
Input Buffering
(a) Unbuffered input: process one char at a time(b) Buffering in user space: buffer may be paged out(c) Buffering in the kernel followed by copying to user space:
buffer may not has been copied yet(d) Double buffering in the kernel
19
Copy Operations Due to Buffering
Networking may involve many copies
20
Review
Layers of the I/O system and the main functions of each layer
21
Disk Hardware (1)model Baracuda ATA II cheetah 73capacity30GB 73GBplates # 3 12heads # 6 24RPM 7200 10025sector size 512B samesector/track 63 463track/in 21368 18145seek timeread 8.2 ms 5.85mswrite 9.5ms 6.35mstrack to track(r) 1.2ms 0.6mstrack to track(w) 1.9ms 0.9ms
22
Disk Hardware (2)
• Physical geometry of a disk with two zones• A possible virtual geometry for this disk
23
RAID
mirroring
• spread byte or word• disks should be synchronized• Hamming code
• no redundancy• same as SLED for a single sector request
24
Disk Hardware (4)
• same as RAID-2• parity instead of Hamming• deals with single failure
25
Disk Formatting
• cylinder skew hides track-to-track seek latency
26
Disk Interleaving
• no interleaving• accessing consecutive sectors
1. move a sector to buffer2. copy buffer to memory3. move next sector….
•cannot utilized contiguous allocation
• single/double interleaving• better buffer entire track instead of a sector
27
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
28
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
29
Stable Storage
• stable storage– writes correct value or leaves the disk intact
• write to mirrored disks– write to disk 1 and verify– do the same to disk 2
• non-volatile RAM speeds up this operation
30
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• names: /dev/ttyx, COM1 and COM2 ports• Computer and terminal are completely independent
31
• Central buffer pool• Dedicated buffer for each terminal
Input Software (1)
32
Display Hardware (1)
Memory-mapped displays• driver writes directly into display's video RAM
Parallel port
33
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
34
X Windows (1)
Clients and servers in the M.I.T. X Window System
35
The SLIM Network Terminal (1)
The architecture of the SLIM terminal system
36
The SLIM Network Terminal (2)
Messages used in the SLIM protocol from the server to the terminals
37
Power Management (1)
Power consumption of various parts of a laptop computer
38
Power management (2)
The use of zones for backlighting the display
39
Power Management (3)
• Running at full clock speed• Cutting voltage by two
– cuts clock speed by two,
– cuts power by four
40
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
41
AutoRAID• Problems with RAID
– difficult to configure
• requires detailed knowledge of disks and workload
• too many parameters to set
– difficult to change the configuration
– difficult to add disks
– RAID 5 preserve an extra disk to cope with a disk failure (hot spare)
• we don’t know if this disk works since it is not used in normal operation
42
AutoRAID• The solutions
– Offer a hierarchy of levels
– store active data in mirrored disks and store inactive data in level 5 arrays
– depending the activity, data are moved across this hierarchy
– the active set must be
• small to be fitted into the mirrored disk
• be unchanged for a long time to prevent frequent data movement
43
Hierarchy Implementation• manually by the system administrator
– error-prone
– cannot adapt to rapidly changing access patterns
– requires highly skilled person
– difficult to add new disks
• file system– best place since it is aware of access patterns for each file and it is a
software
– not in customer’s hand
• array controller (behind scsi controller)– devoid of the knowledge of access patterns
– make the array look like a normal disk
44
AutoRAID Features• Mapping: maps host block address to physical location
• Mirroring and RAID 5– use mirroring until run short of disk space,
– if space is needed, store some data as RAID 5
– keep data in RAID 1 be at least 10% of all data
– transfer data by the frequency of accesses
• automatic and done in idle time
• online disk upgrade
• dual controllers
• active use of hot spares– when a disk fails, some data in the level 1 are moved to level 5 to
make a room for reconstruction
45
Hardware Configuration
46
Data Layout
– LUN = a number of PEX
– RB is visible to clients
47
Data Layout(2)
48
Mapping Tables
49
Migration• from level 5 to level 1 (from inactive to active)
– when RB is written
• from RAID 1 to RAID 5– in background
– if the data has not been changed for a long time
– if space is needed in Mirror
50
Review• shows a perfect research and development
– hardware development in parallel with the simulator
– an accurate simulator makes it possible to calibrate the design decision before they committed to making a product
• Comparison with CLARiiON and JBOD(Just Bunch of Disks)– Microbenchmark results do not give much intuition
• Would be nice to show what happens when AutoRAID degrades to the mirrored mode
• Not much why, mostly what
• Does not really tell us much about the statistical significance