Date post: | 14-Apr-2018 |
Category: |
Documents |
Upload: | siddharth-sharma |
View: | 221 times |
Download: | 0 times |
of 38
7/27/2019 Chapter 11 hard disk
1/38
1
Chapter 11:
Mass-Storage Structure
Disk attachment
SSD (Solid state drive) vs. HDD (Hard diskdrive)
Disk I/O scheduling
Disk management
Formatting/partitioning
7/27/2019 Chapter 11 hard disk
2/38
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, FCFiber 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 units2
7/27/2019 Chapter 11 hard disk
3/38
7/27/2019 Chapter 11 hard disk
4/38
Erase and SSD
Erase: Writing to the SSD must be
preceded by a block erase (sets all bits to 1)
Lifetime: Measured in the number of erase
cycles
Wear leveling: Firmware or operating
system drivers must balance the numbers oferase cycles done on each block so that
device does not fail prematurely
4
7/27/2019 Chapter 11 hard disk
5/38
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
With parallel chip operation, 250 MB/seffective read/write speeds
5
http://en.wikipedia.org/wiki/Solid-state_drive
http://en.wikipedia.org/wiki/Solid-state_drivehttp://en.wikipedia.org/wiki/Solid-state_drivehttp://en.wikipedia.org/wiki/Solid-state_drivehttp://en.wikipedia.org/wiki/Solid-state_drive7/27/2019 Chapter 11 hard disk
6/38
hdparm command
Measuring disk performance yourself on
Linux
http://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.html
Old disk system: 57.9 MB/sec
6
http://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.htmlhttp://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.html7/27/2019 Chapter 11 hard disk
7/38
Virtual Box Linux
sudo hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 15392 MB in 2.00
seconds = 7705.18 MB/sec
Timing buffered disk reads: 154 MB in 3.02
seconds = 50.96 MB/sec
7
7/27/2019 Chapter 11 hard disk
8/38
8Figure 11.1 Moving-head disk mechanism (HDD)
7/27/2019 Chapter 11 hard disk
9/38
http://www.cprince.com/courses/cs5631spring09/news/item1.pdf
(Presentation by Yizhao Zhuang)
7/27/2019 Chapter 11 hard disk
10/38
10
HDD (Hard Disk Drive) Terms Access (positioning) time
Time to start to transfer dataComponents: Seek time, rotational latency
Seek time: time for disk arm to move heads to theright cylinder
Rotational latency: time for disk to rotate to thedesired sector
Transfer rate
Sustained bandwidth: average data transfer
rate during a large transferthat is the, numberof bytes divided by transfer time
data rate without positioning time
Effective bandwidth: average transfer rate
including positioning time
7/27/2019 Chapter 11 hard disk
11/38
11
HDD Scheduling
Modern disks are accessed as a large arrayof blocks:
a disk addressis a block number
Block number is converted to a old styledisk address (i.e., cylinder, head, sector) bythe disk device firmware
Generally, increasing block number impliesphysically adjacent sectors (see alsohttp://www.linuxjournal.com/article/6931),and movement to inner cylinders of disk
http://www.linuxjournal.com/article/6931http://www.linuxjournal.com/article/69317/27/2019 Chapter 11 hard disk
12/38
7/27/2019 Chapter 11 hard disk
13/38
Some Algorithms To Reduce Seek Time
Algorithm Name Description
FCFS First-come first-served
SSTF Shortest seek time first; process the
request that reduces next seek time
SCAN (akaElevator)
Move head from end to end (has acurrent direction)
C-SCAN Only service requests in one direction
(circular SCAN)
LOOK Move head from end to end; turn atlast request in direction
C-LOOK Only service requests in one direction
and turn at last request in direction
(circular LOOK)
7/27/2019 Chapter 11 hard disk
14/38
14
Scheduling Examples
Assume List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67
Left most is first request
R/W head starts at track 53
Tracks range from 0-199
Only a single platter
Question:Given a specific scheduling algorithm what is
the total head movement required for a list oftrack requests?
7/27/2019 Chapter 11 hard disk
15/38
15
FCFS
Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67
Left most is first request
R/W head starts at track 53
Tracks range from 0-199
Only a single platter
1) Show the head movement over the disk surface2) What is the total head movement?
7/27/2019 Chapter 11 hard disk
16/38
16
FCFS
Total head movement: 640 tracks
98-53=45
183-98=85
183-37=146122-37=85
122-14=108
124-14=110
124-65=59
67-65=2
7/27/2019 Chapter 11 hard disk
17/38
17
FCFS Performance Issues
It is possible for disk positions far from a
current area of activity to bestarved
indefinitely?
No. With FCFS, incoming (new) requests
will eventually get processed.
We are not reordering requests here.
The algorithm is intrinsically fair, but it
generally does not generally provide the
fastest service.
7/27/2019 Chapter 11 hard disk
18/38
18
SSTF: Shortest Seek Time First
Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67
Left most is first request
R/W head starts at track 53
Tracks range from 0-199
Only a single platter
1) Show the head movement over the disk surface2) What is the total head movement?
7/27/2019 Chapter 11 hard disk
19/38
19
SSTF exampleQueue Head pos Seek time
98 53 45
183 53 130
37 53 16
122 53 69
14 53 39
124 53 71
65 53 12
67 53 14
SST= 12
Queue Head pos Seek time
98 65 33
183 65 118
37 65 28
122 65 57
14 65 51
124 65 59
67 65 2
SST= 2
Queue Head pos Seek time
98 67 31
183 67 116
37 67 30
122 67 55
14 67 53
124 67 57
SST= 30
Queue Head pos Seek time
98 37 61
183 37 146
122 37 85
14 37 23
124 37 87
SST= 23
Queue Head pos Seek time
98 14 84
183 14 169
122 14 108
124 14 110
SST= 84
Queue Head pos Seek time
183 98 85
122 98 24
124 98 26
SST= 24
Queue Head pos Seek time
183 122 61
124 122 2
SST= 2
Queue Head pos Seek time
183 124 59
SST= 59
Total head movement:
236 tracks
7/27/2019 Chapter 11 hard disk
20/38
20
SSTF
Total head movement:236 tracks
7/27/2019 Chapter 11 hard disk
21/38
21
SSTF Performance Issues
It is possible for disk positions far from a current
area of activity to be starved indefinitely?
YES: If new requests keep arriving for the current area
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
SCAN
7/27/2019 Chapter 11 hard disk
22/38
SCAN
Algorithm: Move head from end to end (has a
current direction), servicing requests as you cometo them
Assume
List (queue) of track requests:
98, 183, 37, 122, 14, 124, 65, 67 Left most is first request
R/W head starts at track 53
Tracks range from 0-199
Only a single platter
Start direction = down (to lower numbered tracks)
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
7/27/2019 Chapter 11 hard disk
23/38
23
SCAN
Total head movement: 53 + 183 = 236
7/27/2019 Chapter 11 hard disk
24/38
24
SCAN Performance Issues
It is possible for disk positions far from a
current area of activity to be starved
indefinitely?
7/27/2019 Chapter 11 hard disk
25/38
25
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
R/W head starts at track 53
Tracks range from 0-199
Only a single platter
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?
7/27/2019 Chapter 11 hard disk
26/38
7/27/2019 Chapter 11 hard disk
27/38
7/27/2019 Chapter 11 hard disk
28/38
28
C-LOOK
Total head movement: (183-53)+(37-14)=153 (+ wrap)
7/27/2019 Chapter 11 hard disk
29/38
29
Algorithm Selection Issues
Starvation FCFS, SCAN and LOOK algorithms will not starve
requests
SSTF can starve requests
Type of request activity Some requests will be to similar tracks of disk
E.g., Requests by a single process for a file allocated using
contiguous file allocation
FCFS, SSTF: Should do well with these clustered requests Some requests will be on widely different tracks of disk
E.g., Indexed, linked file allocation; requests by different
processes
May be best to have algorithm that distributes requests
uniformly across surface of disk (e.g., SCAN, LOOK)
7/27/2019 Chapter 11 hard disk
30/38
30
Ch 11.5: Disk Management
Disk formatting
Swap space
Boot blocks & Booting
7/27/2019 Chapter 11 hard disk
31/38
31
Ch 11.5.1: Disk Formatting Three steps
Low-level formatting, partitioning, logical formatting
Low-level formatting
Fills disk sectors with special data structure that is usedby 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 correctingcode)
Creates map of bad blocks
Reserves spare sectors for bad block repair
Partitioning
Grouping disk into one or more groups of cylinders tobe treated as separate logical disks
Each partition can have its own file system type
7/27/2019 Chapter 11 hard disk
32/38
32
Logical Formatting
(Per Partition)
Creation of organization for different types of filesystems, swap space, database application etc. E.g., directory structures, free space lists
Boot partitions Boot block; code to load kernel of O/S
It is also possible to leave the partition withoutlogical formatting With no file system disk data structures
Partition accessed as an array of blocks raw disk, and raw I/O
Raw I/O bypasses file system services such as buffercache, file locking, prefetching, space allocation, filenames, and directories
H dli B d Bl k
7/27/2019 Chapter 11 hard disk
33/38
33
Handling Bad Blocks Can handle at free blocks level in O/S
Free list of blocks can be used to indicate these blockscannot be used
Device controller
Can maintain list of bad blocks
Initialized during low-level formatting at factory
Low-level formatting also sets aside spare sectors, notvisible to O/S
Sectorsparing or forwardingcan be used to managenew bad blocks
Sparing or forwarding: Controller uses a spare sector when itgets a request for a sector that has a bad block
When block is remapped, controller uses a spare sector fromthe same cylinder if possible
Sector slipping: Moving a sequence of blocks & re-
mapping them
S ap Space
7/27/2019 Chapter 11 hard disk
34/38
Swap Space Virtual memory
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 highervirtual memory performance: Why?
With a separate partition, swap space managerallocates/deallocates blocks
Doesnt use functions of normal file system
Maintain map(s) of swap space usage
May handle text (code) & data differently
E.g., Solaris 1dont write text to swap disk; if pagereplacement needs page, next time just re-read fromnormal file system; dirty data pages still written to swap
disk as needed
7/27/2019 Chapter 11 hard disk
35/38
Boot Process
Typically a three phase process ROM bootstrap Boot block loader
Running operating system kernel
ROM bootstrap program Initial program code that starts loading operating
system
Typically a relatively simple loader program stored in
ROM;reads the disk boot block(s) into RAM, andstarts running this boot block code
Boot block code
Actually does loading of operating system kernel fromboot partition
RAID: Redundant Array of
7/27/2019 Chapter 11 hard disk
36/38
RAID: Redundant Array of
Independent/Inexpensive Disks
Multiple disk techniques for Improving throughput and/or response time
Multiple disks, parallelize disk operations
Improving data reliability
Decrease mean time to failure (MTBF) If one disk fails, can replace with another and go on quickly,
with easy recovery
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, blocki goes on disk (i mod n) + 1
Methods of improving reliability
Mirroring(a.k.a.shadowing): duplicating all data
Parity, ECC (error correcting codes)
7/27/2019 Chapter 11 hard disk
37/38
37
Resources
Kernel Korner - I/O Schedulers
http://www.linuxjournal.com/article/6931
Describes soft deadline disk head schedulingand anticipatory scheduling in Linux 2.6 kernel
See also the CFQ scheduler (Complete Fair
Queuing Scheduler)http://en.wikipedia.org/wiki/CFQ
http://www.linuxjournal.com/article/6931http://www.linuxjournal.com/article/69317/27/2019 Chapter 11 hard disk
38/38
END!
38