Beruflich Dokumente
Kultur Dokumente
Disk attachment SSD (Solid state drive) vs. HDD (Hard disk drive) Disk I/O scheduling Disk management
Formatting/partitioning
1
Disk Attachment
Host-attached storage
Storage accessed on host through local I/O port Uses hardware bus and host controller (e.g., IDE, ATA, SATA, FireWire, USB, SCSI, FC Fiber Channel)
Network-attached storage
Special purpose storage system attached remotely over a data network Clients access severs via RPC (e.g., NFS for Unix systems or CIFS for Windows systems)
Storage-area network
Private network (using storage protocols) connecting file servers and storage units
2
SSD Performance
Single chip has relatively high latencies (SLC NAND)
~25 s to fetch (read) a 4K page from the array to the IO buffer ~250 s to commit (write) a 4K page from the IO buffer to the array ~2 ms to erase a 256 kiB block
hdparm command
Measuring disk performance yourself on Linux
http://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.html
Transfer rate
Sustained bandwidth: average data transfer rate during a large transfer that is the, number of bytes divided by transfer time
data rate without positioning time
10
HDD Scheduling
Modern disks are accessed as a large array of blocks:
a disk address is a block number
Block number is converted to a old style disk address (i.e., cylinder, head, sector) by the disk device firmware Generally, increasing block number implies physically adjacent sectors (see also http://www.linuxjournal.com/article/6931), and movement to inner cylinders of disk
11
Disk Requests
Typically a disk device has a queue with several pending requests
One issue: How can we schedule requests to (a) improve system performance and throughput, and (b) reduce request latency?
Process priority could play a role Reduce access time by changing order of requests
Just consider seek time
12
First-come first-served
Shortest seek time first; process the request that reduces next seek time Move head from end to end (has a current direction) Only service requests in one direction (circular SCAN)
LOOK
C-LOOK
Move head from end to end; turn at last request in direction Only service requests in one direction and turn at last request in direction (circular LOOK)
Scheduling Examples
Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67 Left most is first request
Question:
Given a specific scheduling algorithm what is the total head movement required for a list of track requests?
14
FCFS
Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67 Left most is first request
1) Show the head movement over the disk surface 2) What is the total head movement?
15
FCFS
98-53=45
183-98=85 183-37=146 122-37=85 122-14=108 124-14=110 124-65=59 67-65=2
16
The algorithm is intrinsically fair, but it generally does not generally provide the fastest service.
17
1) Show the head movement over the disk surface 2) What is the total head movement?
18
SSTF example
Queue 98 183 37 122 14 124 65 67
Head pos Seek time Head pos Seek time Queue 53 45 98 65 33 183 65 118 53 130 37 65 28 53 16 122 65 57 53 69 14 65 51 53 39 124 65 59 53 71 67 65 2 53 12 53 14 SST= 2 SST= 12
Queue 98 183 37 122 14 124 Head pos Seek time 67 31 67 116 67 30 67 55 67 53 67 57 SST= 30
Head pos Seek time Head pos Seek time Queue 37 61 98 14 84 37 146 183 14 169 122 14 108 37 85 37 23 124 14 110 37 87 SST= 84 SST= 23
Queue Head pos Seek time 183 124 59 SST= 59
Queue Head pos Seek time 183 122 61 124 122 2 SST= 2
SSTF
20
Prefer a method that we know will not starve requests Also, while better than FCFS (236 for SSTF vs. 640 for FCFS), less head movement can be obtained
E.g., service order: 53, 37, 14, 65, 67, 98, 122, 124, 183 has total head movement of 208 tracks
21
SCAN
Algorithm: Move head from end to end (has a current direction), servicing requests as you come to them Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67 Left most is first request
1) Show the head movement over the disk surface 2) What is the total head movement? From start position to servicing last request in list
SCAN
23
24
C-SCAN
Algorithm: Only service requests in one direction (circular SCAN) Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67 Left most is first request
Start direction = up (to higher numbered tracks) Service requests (only) in up direction
1) Show the head movement over the disk surface 2) What is the total head movement?
25
C-SCAN
26
C-LOOK
Algorithm: Only service requests in one direction and turn at last request in direction (circular LOOK) Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67 Left most is first request
1) Show the head movement over the disk surface 2) What is the total head movement?
27
C-LOOK
28
29
30
Low-level formatting
Fills disk sectors with special data structure that is used by disk I/O controller Header, data area (usually 512 bytes), trailer
Header & trailer: information used by disk controller hardware-- e.g., sector number and ECC (error correcting code)
Creates map of bad blocks Reserves spare sectors for bad block repair
Partitioning
Grouping disk into one or more groups of cylinders to be treated as separate logical disks Each partition can have its own file system type
31
Boot partitions
Boot block; code to load kernel of O/S
32
Device controller
Can maintain list of bad blocks Initialized during low-level formatting at factory Low-level formatting also sets aside spare sectors, not visible to O/S Sector sparing or forwarding can be used to manage new bad blocks
Sparing or forwarding: Controller uses a spare sector when it gets a request for a sector that has a bad block When block is remapped, controller uses a spare sector from the same cylinder if possible
33
Virtual memory
Swap Space
Will use regular file system for at least reading code and data of program Swap space may be on separate device or multiple devices Partition formatted for swap space can give higher virtual memory performance: Why?
Boot Process
Typically a three phase process
ROM bootstrap Boot block loader Running operating system kernel
Ideas
Data striping: Methods of improving throughput
Putting part of data on disk A, part on disk B, part on Bit striping: e.g., 8 disks, one bit of each byte on each disk Block striping: n disks, block i goes on disk (i mod n) + 1
Resources
Kernel Korner - I/O Schedulers
http://www.linuxjournal.com/article/6931 Describes soft deadline disk head scheduling and anticipatory scheduling in Linux 2.6 kernel
END!
38