CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache...
-
Upload
trinhhuong -
Category
Documents
-
view
214 -
download
0
Transcript of CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache...
![Page 1: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/1.jpg)
CISC 7310X
C11: Mass StorageHui Chen
Department of Computer & Information Science
CUNY Brooklyn College
4/19/2018 1CUNY | Brooklyn College
![Page 2: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/2.jpg)
Outline
• Review of memory hierarchy
• Mass storage devices
• Reliability and performance
• Redundancy and parallelism
• Disk arm scheduling
• Error handling and stable storage
• Further reading
• Assignment
4/19/2018 CUNY | Brooklyn College 2
![Page 3: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/3.jpg)
Memory Hierarchy
2/1/2018 CUNY | Brooklyn College 3
Secondary Memory (e.g., Magnetic Disk)
Main Memory
Cache
Registers
~10ms
~10ns
~2ns
~1ns
~TB
~GB
~MB
<KB
Tertiary Memory (e.g., Magnetic Tapes)
![Page 4: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/4.jpg)
I/O Design
• User and programming interfaces
• Internal data structures and algorithms
• Secondary and tertiary storage structures
4/19/2018 CUNY | Brooklyn College 4
Data structure & algorithms
Focus of the discussion
![Page 5: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/5.jpg)
Design Goals
• Function
• They need to work, read & write
• Reliability
• Murphy’s law
• "Anything that can go wrong will go wrong“
• How do we make it appearing reliable?
• I/O Efficiency (performance)
• We need it to be “fast”
• Energy efficiency
4/19/2018 CUNY | Brooklyn College 5
![Page 6: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/6.jpg)
Mass Storage Devices
• Disks
• Magnetic disks
• Solid state drives
• Optical disks
4/19/2018 CUNY | Brooklyn College 6
![Page 7: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/7.jpg)
Magnetic Disks
• Disk arm
• Read-write head
• Platter
• 60 ~ 200 rounds/second
• 1.8 ~ 5.25 inches
• Tracks
• Sectors
• Cylinder
4/19/2018 CUNY | Brooklyn College 7
![Page 8: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/8.jpg)
Magnetic Disks: Characteristics
• Size and rotation speed
• Transfer rate
• The rate at which data flow between the drive and the host
• Random-access time (or position time)
• Random-seek time (or seek time)
• time required to move the arm to the desired cylinder
• Rotational latency
• Time required for the desired sector to rotate to the disk head
• Head crash
• Read-write head make contact with the platter surface
• Bit rot
• Degradation of data, such as, as the result of gradually lose of magneticity
4/19/2018 CUNY | Brooklyn College 8
![Page 9: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/9.jpg)
Magnetic Disks: Improvement
• Improvement over time
• Gradual improvement of moving parts and more rapid improvement of bit densities
1978 2008
4/19/2018 CUNY | Brooklyn College 9• [Figure 5-18 in Tanenbaum & Bos, 2014]
![Page 10: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/10.jpg)
Magnetic Disks: Zones
• Logical (virtual) geometry and physical geometry are differ
• Traditionally, (x, y, z): (cylinders, heads, sectors), i.e., CHS
• PC: (65535, 16, 63), a sector is typically 512 bytes
• Modern approach: logical block addressing (LBA), disk sectors numbered consecutively starting at 0
4/19/2018 CUNY | Brooklyn College 10
(a) (b)
• [Figure 5-19 in Tanenbaum & Bos, 2014] Figure 5-19. (a) Physical geometry of a disk with two zones. (b) A possible virtual geometry for this disk
![Page 11: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/11.jpg)
Disk Structure
• Logical blocks
• To the host, the disks are a one-dimensional array of logical blocks
• Smallest unit of data transfer between the disk and the host
• Disk sector
• A logical block mapped to one or more disk sectors
• A sector is typically 29 = 512 bytes
• LBA or CHS
• Constant linear velocity
• Optical disks
• Constant angular velocity
• Magnetic disks
4/19/2018 CUNY | Brooklyn College 11
![Page 12: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/12.jpg)
I/O Bus
• Interface to host via I/O bus
• Enhanced integrated drive electronics (EIDE)
• Advanced technology attachment (ATA)
• Serial ATA (SATA)
• Universal serial bus (USB)
• Fiber channel (FC)
• Small computer-systems interface (SCSI)
4/19/2018 CUNY | Brooklyn College 12
![Page 13: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/13.jpg)
Host and Disk Controllers
• Controllers, responsible for data transfer via the I/O bus
• Host controller (Host Bus Controller/Adaptor, HBA, e.g., on the motherboard of a PC)
• CPU places a command to the controller, typically using memory-mapped I/O ports
• LBA: present the disk to the host as a consecutively numbered sectors
• Disk controller (inside the disk drive)
• Host controller sends the command via messages to disk controller
• Build-in memory buffer/cache
• Data transfer between platters and cache, limited by speed of physical movements
• Data transfer between the host controller and the cache, at faster electronic speeds
4/19/2018 CUNY | Brooklyn College 13
![Page 14: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/14.jpg)
Questions?
• Review of memory hierarchy
• Concepts about magnetic disk
4/19/2018 CUNY | Brooklyn College 14
![Page 15: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/15.jpg)
Reliability and Performance
• Performance
• Parallel processing
• Reliability
• Redundancy
4/19/2018 CUNY | Brooklyn College 15
![Page 16: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/16.jpg)
Redundancy and Data Loss
• Failure = lost of data; Mean time to failure (MTBF) of a single disk drive and many disk drives
• Example
• MTBF of a single disk drive: 1,000,000 hours
• 100 disk drives: 1,000,000/100 = 10,000 hours = 416.7 days
• Mirroring: duplicate disk drive
• Example: two physical disk drives are presented as a logical disk drive (mirrored volume)
• Failure: failure of two physical disk drives
• Mean time to repair (MTBR): time required to replace the failure disk drive
• With mirroring
• MTBF = 1,000,000 hours; MTBR = 10 hours
• Mean time to data loss: failure of the mirrored volume (the 2nd disk drive also failed before the 1st could be replaced) : 1,000,0002 / (2 x 10) =5 x 1010 hours = 5.7 x 106 years!
4/19/2018 CUNY | Brooklyn College 16
![Page 17: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/17.jpg)
Practical Consideration
• Disk failures are not independent
• Example
• Large number of disk drive failures can be the result of a power failure and a tremor of a minor earthquake
• Manufacturing defects in a batch of disk drives can lead to correlated failures
• The probability of failure grows as disk drives age
• Mean time to data loss is smaller
4/19/2018 CUNY | Brooklyn College 17
![Page 18: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/18.jpg)
Parallelism and Performance
• Observation
• Duplicating disk drives doubles the rate at which read requests can be handled
• Data stripping
• Splitting data across multiple disk drives
• Bit-level stripping
• Splitting the bits of each byte across multiple disk drives
• Example: using an array of 8 disks (or a factor of 8 or a multiple of 8)
• Block-level stripping
• Splitting blocks of a file across multiple disk drives
• Benefits
• Increase the throughput of multiple small accesses (page accesses)
• Reduce the response time of large accesses
4/19/2018 CUNY | Brooklyn College 18
![Page 19: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/19.jpg)
Redundant Array of Inexpensive Disks (RAID)
• 6 levels (not counting 0)
• RAID Level 0
• RAID Level 1
• …
• RAID Level 6
4/19/2018 CUNY | Brooklyn College 19
![Page 20: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/20.jpg)
RAID Level 0 - 3
• Level 0 (not a true RAID): Stripping only
• Level 1: Mirror + stripping
• Level 2: Memory-style error-correction-code (ECC) organization
• Example
• Split a byte into 4-bit nibbles
• Add Hamming code (3 bits) to each
• One bit per drive onto 7 disk drives
• Level 3: Bit-interleaved parity organization
• Compute a parity bit
• Driver detects error, a parity bit is sufficient to correct error (unlike memory)
• Backup and parity drives are shown shaded.
4/19/2018 CUNY | Brooklyn College 20
![Page 21: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/21.jpg)
RAID Level 4 - 6
• Level 4: block-interleaved parity organization
• Stripping
• Compute parity for blocks
• One disk for parities
• Level 5: block-interleaved distributed parity
• Stripping
• Compute parity for blocks
• Parities are distributed
• Level 6: P+Q redundancy scheme
• Extra redundant information to guard multiple disk failures
• Backup and parity drives are shown shaded.
4/19/2018 CUNY | Brooklyn College 21
![Page 22: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/22.jpg)
RAID 0+1 and 1+0
• Combination of RAID levels 0 and 1
• RAID 0+1: stripping and then mirroring
• RAID 1+0: mirroring and then stripping
4/19/2018 CUNY | Brooklyn College 22
![Page 23: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/23.jpg)
Selecting RAID Level
• RAID 0: high performance, data loss is not critical
• RAID 1: high reliability with fast recovery
• RAID 0+1 & 1+0: both performance and reliability
• Expense: 2 for 1
• RAID 5:
• Often preferred for large volumes of data
• Required number of disks?
4/19/2018 CUNY | Brooklyn College 23
![Page 24: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/24.jpg)
Limitation of RAID
• RAID only protects physical media errors, but not other hardware and software errors
• RAID is not flexible
• Present a disk array as a volume
• What if a file system is small, or large, or change over time?
4/19/2018 CUNY | Brooklyn College 24
volume volume volume
FS FS FS
![Page 25: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/25.jpg)
Solaris ZFS
• Combines file-system management and volume management into one unit
• Maintains a checksums of all blocks and data structures to support error detection and recovery
• A storage pool holds one or more ZFS file systems
• ZFS uses “allocate” and “free” model makes the storage pool available to each file system
4/19/2018 CUNY | Brooklyn College 25
Storage pool
ZFS ZFS ZFS
![Page 26: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/26.jpg)
Questions
• Reliability and performance
• Performance via parallelism
• Reliability via redundancy
• RAID
• Which level to use? How many disks?
4/19/2018 CUNY | Brooklyn College 26
![Page 27: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/27.jpg)
Disk Formatting
• Low-level formatting
• Partition and Logical formatting
4/19/2018 CUNY | Brooklyn College 27
![Page 28: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/28.jpg)
Low-level Formatting
• Each disk must receive a low-level format done by software
• To form a series of concentric tracks
• each consists of some number of sectors
• with short gaps between sectors
• Typically performed at the factory as the part of the manufacturing process
4/19/2018 CUNY | Brooklyn College 28
![Page 29: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/29.jpg)
Disk Sector
• Preamble
• A bit pattern that allows the hardware to recognize the start of the sector
• Data
• Typically 512 bytes, some allows a few sizes (e.g., 256, 512, 1024)
• Error-correction code (ECC)
• Computed based on the data to correct bit errors in data
4/19/2018 CUNY | Brooklyn College 29
A Disk Sector
![Page 30: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/30.jpg)
Partition and High-level Formatting• Partition
• Divide the disk into one or more groups of cylinders
• OS treats each partition as though it were a sperate disk
• Logical formatting
• Creating a file system on a partition, i.e., storing the initial file-system data structures onto the partition
• Example
• Maps of free and allocated space, an initial empty directory
• Most file systems group blocks tougher into larger chunks, called clusters
• Disk I/O: minimal unit is a block
• File system I/O: minimal unit is a cluster
4/19/2018 CUNY | Brooklyn College 30
![Page 31: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/31.jpg)
Boot Block
• An OS must have an initial bootstrap program
• Typical design
• The bootstrap program is in a read-only memory (ROM) with a fixed address
• It loads and runs another small program stored at a fixed location on the disk, called the “boot block”
• Example
• Windows places its boot code and a partition table in the first sector of the hard disk (sector 0, called Master Boot Record, or MBR)
• The boot code loads another small program at the first sector (called the bot sector) of a designated partition, called the boot partition
• The code in the boot sector loads the OS and the device drivers in the boot partition.
4/19/2018 CUNY | Brooklyn College 31
![Page 32: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/32.jpg)
Questions?
• Disk formatting
• Low-level formatting
• Partition and logical formatting
• Formatting and boot block
4/19/2018 CUNY | Brooklyn College 32
![Page 33: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/33.jpg)
Seek Time and Disk Arm Scheduling• Recall the factors of a disk block read/write
performance
• Seek time (the time to move the arm to the proper cylinder).
• Rotational delay (how long for the proper sector to come under the head).
• Actual data transfer time.
• The seek time often dominates.
• Can we reduce the seek time?
4/19/2018 CUNY | Brooklyn College 33
![Page 34: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/34.jpg)
Disk Arm Scheduling Problem
• Assumption
• A disk driver accepts bursts of access requests
• Problem
• In which order should these requests be carried out to minimize the seek time?
• Average seek time?
• Overall seek time?
4/19/2018 CUNY | Brooklyn College 34
![Page 35: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/35.jpg)
Disk Arm Scheduling Algorithms
• First-Come, First Served (FCFS)
• Shortest-Seek-First/Shortest-Seek-Time-First (SSF/SSTF)
• The elevator algorithm
• LOOK
4/19/2018 CUNY | Brooklyn College 35
![Page 36: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/36.jpg)
First-Come, First Served
• Requests: when 11 being sought to, request to seek to cylinders 1, 36, 16, 34, 9, and 12 arrived
• Total arm movements
• |11 – 1| = 10
• |1 – 36| = 35
• …
4/19/2018 CUNY | Brooklyn College 36
![Page 37: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/37.jpg)
Shortest-Seek-First
• Requests: when 11 being sought to, request to seek to cylinders 1, 36, 16, 34, 9, and 12 arrived
• Resulting sequence: 12, 9, 16, 1, 34, 36
4/19/2018 CUNY | Brooklyn College 37
• [Figure 5-24 in Tanenbaum & Bos, 2014]
![Page 38: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/38.jpg)
Elevator in a Tall Building
• The arm scheduling is like scheduling an elevator in a tall building
• Shortcoming of STFS
• Fairness
• In a busy system, the arm tends to stay at the middle of the disk
• Elevator scheduling …
4/19/2018 CUNY | Brooklyn College 38
![Page 39: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/39.jpg)
LOOK
• Maintains a flag whose value is up or down
• If the flag is up
• If having higher request (cylinder bigger)
• Seek to the cylinder
• Else
• Reverse the flag
• If the flag is down
• If having lower request (cylinder lower)
• Seek to the cylinder
• Else
• Reverse the flag
4/19/2018 CUNY | Brooklyn College 39
![Page 40: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/40.jpg)
LOOK: Example
• Requests: when 11 being sought to, request to seek to cylinders 1, 36, 16, 34, 9, and 12 arrived
4/19/2018 CUNY | Brooklyn College 40
• [Figure 5-25 in Tanenbaum & Bos, 2014]
![Page 41: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/41.jpg)
Selecting Scheduling Algorithm
• Performance: SSF is common, as it increases performance over FCFS
• Fairness: The Elevator algorithm balances fairness and performance for busy systems
• Computation: It must finish computing the schedule before the seek is completed
• Number and types of requests
• File allocation method: Are files continuously allocated on the disk?
• Locations of directories and index blocks
• To read the file, we need first read the directory/index blocks data to locate the file
• Caching the directories and index blocks?
• Disk-scheduling algorithms should be written as a separate module, and can be replaced if necessary
4/19/2018 CUNY | Brooklyn College 41
![Page 42: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/42.jpg)
Questions?
• Disk arm scheduling algorithms
• No optimization
• FCFS
• Reduce seek time
• SSF
• Balance fairness and performance
• LOOK
4/19/2018 CUNY | Brooklyn College 42
![Page 43: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/43.jpg)
Bad Blocks and Sectors
• Murphy’s Law
• "Anything that can go wrong will go wrong".
• How do we handle error?
• A disk can have bad blocks or bad sectors
• A read does not produce the data just written to it
• ECC can correct small number of bits errors
4/19/2018 CUNY | Brooklyn College 43
![Page 44: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/44.jpg)
Error Handling of Bad Blocks
• Deal with them in the controller
• Deal with them in the OS
4/19/2018 CUNY | Brooklyn College 44
![Page 45: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/45.jpg)
Spare Substitution by Disk Controller • Disk controller handles the bad sectors
• During the testing at the factory as the manufacturing process
• Disk comes with spare sectors
• Replace each bad sector by a spare
• These steps are also performed during normal operation
• Transient errors are overcome by repeated read attempts
• Repeated errors trigger spare substitution
4/19/2018 CUNY | Brooklyn College 45
![Page 46: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/46.jpg)
Spare Substitution
• Two approaches shown in (b) and (c)
4/19/2018 CUNY | Brooklyn College 46
• [Figure 5-26 in Tanenbaum & Bos, 2014]
![Page 47: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/47.jpg)
Questions?
• Error handling
4/19/2018 CUNY | Brooklyn College 47
![Page 48: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/48.jpg)
Stable Storage
• An “all or none” property
• A property that a write request is issued to the disk, the disk either correctly writes the data or it does nothing (and reporting error)
4/19/2018 CUNY | Brooklyn College 48
![Page 49: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/49.jpg)
Error Model
• The system detects an error via the value of the ECC field
• Example
• 16-byte ECC, 512-byte sector
• Data values: 2512x8=24096
• ECC values: 216x8=2128
• There is always a tiny chance that an error is not detected.
4/19/2018 CUNY | Brooklyn College 49
![Page 50: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/50.jpg)
Design of Stable Storage
• Uses pair of identical disks
• Either can be read to get same results
• Operations defined to accomplish this:
1. Stable Writes
2. Stable Reads
3. Crash recovery
4/19/2018 CUNY | Brooklyn College 50
![Page 51: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/51.jpg)
Stable Writes
• Foreach disk drive d do
• Set n as 0
• While (Error && n < MAX)
• First write the block on disk drive d
• Read it back
• Verify correctness via ECC (Error or not error)
• Increment n
• If Error, report error
4/19/2018 CUNY | Brooklyn College 51
![Page 52: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/52.jpg)
Stable Readers
• Foreach disk drive d do
• Set n as 0
• While (Error && n < MAX)
• First read the block on disk drive d
• Verify correctness via ECC (Error or not error)
• Increment n
• If Error, report error
4/19/2018 CUNY | Brooklyn College 52
![Page 53: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/53.jpg)
Crash Recovery
• After an OS crash, a recovery program scans both disks and comparing the blocks
• If a pair of blocks are identical, nothing is done
• If one of the pair has an ECC error, the bad block is overwritten with the corresponding good one
• If both have no ECC error, but are different, the block from drive 1 is written on drive 2 (the block on drive 1 is newer).
4/19/2018 CUNY | Brooklyn College 53
![Page 54: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/54.jpg)
Influence of Crash
• Analysis indicates the storage is stable
4/19/2018 CUNY | Brooklyn College 54
• [Figure 5-27 in Tanenbaum & Bos, 2014]
![Page 55: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/55.jpg)
Questions?
• Stable storage
• Design
4/19/2018 CUNY | Brooklyn College 55
![Page 56: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/56.jpg)
Further Reading
• Disk Attachment
• Host-attached storage
• Network-attached storage
• Storage-area network
4/19/2018 CUNY | Brooklyn College 56
![Page 57: CISC 7310X C11: Mass Storagehuichen-cs.github.io/course/CISC7310X/18SP/lecture/cisc...Cache Registers ~10ms ~10ns ~2ns ~1ns ~TB ~GB ~MB](https://reader030.fdocuments.us/reader030/viewer/2022020416/5ce7edc488c993ca738b840d/html5/thumbnails/57.jpg)
Assignments
• Group and individual
4/19/2018 CUNY | Brooklyn College 57