operating systems
DESCRIPTION
Operating Systems. Operating Systems. Unit 9: Disk Performance Optimization File Systems. Introduction. Secondary storage is common bottleneck Improvements in secondary storage performance significantly boost overall system performance Physical aspects moving head disk storage - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/1.jpg)
Operating Systems
Unit 9:– Disk Performance Optimization– File Systems
Operating Systems
![Page 2: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/2.jpg)
COP 5994 - Operating Systems 2
Introduction• Secondary storage is common bottleneck
– Improvements in secondary storage performance significantly boost overall system performance
• Physical aspects– moving head disk storage– access optimization
• Logical aspects– file system organization
![Page 3: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/3.jpg)
COP 5994 - Operating Systems 3
Moving-Head Disk Storage
![Page 4: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/4.jpg)
COP 5994 - Operating Systems 4
Disk Surface: traditional
![Page 5: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/5.jpg)
COP 5994 - Operating Systems 5
Disk Surface: modern• Zone Density Recording
– fixed sector size (512 bytes)– variable number of sectors
per track
• outside: zone 0• transfer rate decrease as zone
increases
![Page 6: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/6.jpg)
COP 5994 - Operating Systems 6
Components of disk access
![Page 7: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/7.jpg)
COP 5994 - Operating Systems 7
Disk Speed Examples
![Page 8: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/8.jpg)
COP 5994 - Operating Systems 8
Disk Scheduling Evaluation Criteria
• Throughput– Number of requests serviced per unit of time
• Mean response time– Average time waiting for request to be
serviced• Variance of response times
– Measure of the predictability of response times
– also: starvation
![Page 9: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/9.jpg)
COP 5994 - Operating Systems 9
Scenario: Disk request pattern
![Page 10: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/10.jpg)
COP 5994 - Operating Systems 10
Seek Optimization Strategies
![Page 11: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/11.jpg)
COP 5994 - Operating Systems 11
First-Come-First-Served (FCFS)
– Pro: fair, no starvation, low overhead– Cons: Potential for extremely low throughput
![Page 12: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/12.jpg)
COP 5994 - Operating Systems 12
Shortest-Seek-Time-First (SSTF)
– Pro: high throughput, lower response times– Cons: high variance, possible starvation
![Page 13: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/13.jpg)
COP 5994 - Operating Systems 13
SCAN Disk Scheduling
– Pro: improved variance in response times– Cons: possible starvation, middle tracks preferred
![Page 14: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/14.jpg)
COP 5994 - Operating Systems 14
C-SCAN Disk Scheduling
– Pro: improved variance in response times– Cons: possible starvation
![Page 15: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/15.jpg)
COP 5994 - Operating Systems 15
FSCAN and N-Step SCAN• Groups requests into batches
– FSCAN: “freeze” the disk request queue periodically, service only those requests in the queue at that time
– N-Step SCAN: Service only the first n requests in the queue at a time
• Pros: prevent indefinite postponement, reduce variance of response times
![Page 16: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/16.jpg)
COP 5994 - Operating Systems 16
LOOK and C-LOOK• LOOK: Improvement on SCAN scheduling
– Does move the disk arm to the outer edges of the disk if no requests for those regions are pending
– Pro: more efficient (less head movement)• C-LOOK improves C-SCAN scheduling
– Combination of LOOK and C-SCAN– Pro: Lower variance of response times
at the expense of throughput
![Page 17: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/17.jpg)
COP 5994 - Operating Systems 17
Rotational Optimization Strategies
• SLTF– Shortest-latency-time-first– On a given cylinder, service request with shortest
rotational latency first• SPTF
– Shortest-positioning-time-first– positioning time: seek time plus rotational latency
• SATF– Shortest-access-time-first– Access time: positioning time plus transmission
time
![Page 18: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/18.jpg)
COP 5994 - Operating Systems 18
requests are serviced in the indicated order regardless of the order in which they arrived
SLTF Scheduling
![Page 19: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/19.jpg)
COP 5994 - Operating Systems 19
SPTF Scheduling
Order: B then A– Pro: good performance– Cons: possible starvation
![Page 20: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/20.jpg)
COP 5994 - Operating Systems 20
SATF Scheduling
Order: B then A– Pro: good performance– Cons: possible starvation
![Page 21: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/21.jpg)
COP 5994 - Operating Systems 21
Another example: SPTF Scheduling
Order: B then A
![Page 22: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/22.jpg)
COP 5994 - Operating Systems 22
SATF Scheduling: different order
Order: A then B
![Page 23: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/23.jpg)
COP 5994 - Operating Systems 23
Optimization Strategies Weakness
• require knowledge of – disk performance characteristics– physical disk geometry
• which might not be readily available due to error-correcting data and transparent reassignment of bad sectors
![Page 24: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/24.jpg)
COP 5994 - Operating Systems 24
Other Disk Performance Techniques
• Multiple copies of frequently-accessed data– Access the copy that is closest to read-write head– Can incur significant storage overhead
• Record blocking– Read/write multiple records as single block of data
• Disk arm anticipation– move disk arm to location of next access– If the disk arm incorrectly predicts future disk
accesses, performance can significantly degrade
![Page 25: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/25.jpg)
COP 5994 - Operating Systems 25
Caching and Buffering• Store copy of disk data in faster memory
– Location:• main memory• disk controller• onboard disk
• Read access:– Vastly faster access times than access to
disk– Depends on cache-hit ratio
![Page 26: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/26.jpg)
COP 5994 - Operating Systems 26
Caching and Buffering• Write access:
– cache acts as buffer to delay writing of data until disk is under light load
– caching model:•Write-back caching
– Data not written to disk immediately– Flushed periodically
•Write-through caching– Writes to disk and cache simultaneously– Reduces performance compared to write-back,
but guarantees consistency
![Page 27: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/27.jpg)
COP 5994 - Operating Systems 27
RAID: Redundant Arrays of Independent Disks
– Data stored in strips• Spread across set of disks
– Strips form stripes• Set of strips at same location on each disk
– Fine-grained strip• Yields high transfer rates
– (many disks service request at once)• Array can only process one request at once
– Coarse-grained strips• Might fit an entire file on one disk• Allow multiple requests to be filled at once
![Page 28: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/28.jpg)
COP 5994 - Operating Systems 28
Strips and stripe created from a single file in RAID systems
RAID strips and stripes
![Page 29: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/29.jpg)
COP 5994 - Operating Systems 29
RAID drawbacks• disks have MMTF (mean time to
failure)• more disks decreases MMBF
(between)
• RAID allows data duplication feature– mirroring– strip-based ECC
![Page 30: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/30.jpg)
COP 5994 - Operating Systems 30
RAID levels
![Page 31: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/31.jpg)
COP 5994 - Operating Systems 31
File SystemOrganizes files and manages access
to data• Responsible for file management,
auxiliary storage management, file integrity mechanisms and access methods
• Primarily concerned with managing disk storage space
![Page 32: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/32.jpg)
COP 5994 - Operating Systems 32
File Systems characteristics
• device independence– use file names rather than physical
device ids• backup and recovery capabilities
– to prevent either accidental loss or malicious destruction of information
• encryption and decryption capabilities– to make information useful only to its
intended audience
![Page 33: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/33.jpg)
COP 5994 - Operating Systems 33
Basic File System Concept: Directory
• contains names and locations of other files:– to organize and quickly locate files
• entry stores information such as:– File name– Location– Size– Type– Accessed– Modified and creation times
![Page 34: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/34.jpg)
COP 5994 - Operating Systems 34
Common: Hierarchical File System
![Page 35: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/35.jpg)
COP 5994 - Operating Systems 35
File System Concept: Link• Directory entry that references a data file
or directory located in a different directory– Facilitates data sharing and can make it easier
for users to access files located throughout a file system’s directory structure
• Soft link: – entry containing the pathname for another file
• Hard link– entry that specifies the location of the file
(typically a block number) on the storage device
– needs updating when file moves
![Page 36: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/36.jpg)
COP 5994 - Operating Systems 36
File System Concept: Metadata• Information that protects integrity of file
system– Cannot be modified directly by users
• example: file systems superblock– stores critical information that protects the
integrity of the file system:• The file system identifier • The location of the storage device’s free blocks
– storage device holds redundant copies of superblock
![Page 37: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/37.jpg)
COP 5994 - Operating Systems 37
File System Concept: File Descriptor
• file open operation returns a file descriptor– index to open-file table
• all file access through the file descriptor• open-file table contains file control block:
– file attributes: • symbolic name• location in secondary storage• access control data • etc.
![Page 38: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/38.jpg)
COP 5994 - Operating Systems 38
File System Concept: Mounting
• Combines multiple file systems into one• Mount point:
– directory where the mounted file system is inserted
• Mount table:– information about the location of mount points
and the devices to which they point• When the native file system encounters a
mount point, it uses the mount table to determine the device and type of the mounted file system
![Page 39: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/39.jpg)
COP 5994 - Operating Systems 39
Mounting
Links: only soft links across mounted file systems
![Page 40: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/40.jpg)
COP 5994 - Operating Systems 40
File Allocation• Problem similar to memory
organization
• contiguous allocation schemes have generally been replaced by more dynamic noncontiguous allocation– Files tend to grow or shrink over time– Users rarely know in advance how large
their files will be
![Page 41: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/41.jpg)
COP 5994 - Operating Systems 41
Contiguous File Allocation• Place file data at contiguous addresses on
disk– Advantages
• Successive logical records typically are physically adjacent to one another
– Disadvantages• External fragmentation• Poor performance can result if files grow and shrink over
time• If a file grows beyond the size originally specified and no
contiguous free blocks are available, it must be transferred to a new area of adequate size, leading to additional I/O operations.
![Page 42: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/42.jpg)
COP 5994 - Operating Systems 42
Non-Contiguous File Allocation
• linked-list• tabular• indexed
![Page 43: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/43.jpg)
COP 5994 - Operating Systems 43
Linked-List Noncontiguous File Allocation
block based:– data– pointer
to next block
![Page 44: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/44.jpg)
COP 5994 - Operating Systems 44
Linked-List Noncontiguous File Allocation
• Locating a record – linked list must be searched from the
beginning– if blocks are dispersed throughout the
storage device (which is normal), the search process can be slow as block-to-block seeks occur
• Insertion and deletion are done by modifying the pointer in the previous block
![Page 45: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/45.jpg)
COP 5994 - Operating Systems 45
Linked-List Noncontiguous File Allocation
• Large block sizes– Can result in significant internal
fragmentation• Small block sizes
– May cause file data to be spread across multiple blocks dispersed throughout the storage device
– Poor performance as the storage device performs many seeks to access all the records of a file
![Page 46: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/46.jpg)
COP 5994 - Operating Systems 46
Tabular Noncontiguous File Allocation
• directory entry lists first block of file
• table cell stores link to next block
• empty table cell marks end of file
ex.: FAT file system
![Page 47: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/47.jpg)
COP 5994 - Operating Systems 47
Tabular Noncontiguous File Allocation
• Pros:– reduces the number of lengthy seeks
required to access a particular record– table can be cached so that the chain of
blocks that compose a file can be traversed quickly
• Cons:– cell entry size/block size dictates file system
size– table can grow too large to cache
![Page 48: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/48.jpg)
COP 5994 - Operating Systems 48
Indexed Noncontiguous File Allocation
• directory entry lists index block(s)
• index blocks lists data blocks
• index block reserves last few entries for more index blocks
![Page 49: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/49.jpg)
COP 5994 - Operating Systems 49
Indexed Noncontiguous File Allocation
• Pros:– Searching takes place in the index
blocks • File systems typically place index
blocks near the data blocks they reference, so the data blocks can be accessed quickly after their index block is loaded
![Page 50: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/50.jpg)
COP 5994 - Operating Systems 50
Unix Indexed Noncontiguous File Allocation
• multi-level index blocks
![Page 51: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/51.jpg)
COP 5994 - Operating Systems 51
Free Space Management• manage the storage device’s free space• Free list:
– Linked list of blocks containing locations of free blocks
– Blocks are allocated from the beginning of free list
– Pro: low overhead– Con: blocks are non-contiguous
![Page 52: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/52.jpg)
COP 5994 - Operating Systems 52
Free Space Management via bitmap
![Page 53: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/53.jpg)
COP 5994 - Operating Systems 53
Free Space Management• Advantage of bitmaps over free lists:
– The file system can quickly determine if contiguous blocks are available at certain locations on secondary storage
• Disadvantage of bitmaps:– The file system may need to search the
entire bitmap to find a free block, resulting in substantial execution overhead
![Page 54: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/54.jpg)
COP 5994 - Operating Systems 54
Data Integrity Protection• System crashes, natural disasters and
malicious programs can destroy information
• Protection:– backup and recovery
• physical backup• logical backup• incremental backup
– RAID– transaction based file systems
![Page 55: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/55.jpg)
COP 5994 - Operating Systems 55
Journaling File Systems
– Windows: NTFS– Linux: ext3
• file system operations are logged as transactions
• compromise:– log only metadata transactions
![Page 56: Operating Systems](https://reader035.vdocuments.mx/reader035/viewer/2022070502/56814a93550346895db79f5a/html5/thumbnails/56.jpg)
COP 5994 - Operating Systems 56
Agenda for next week:
– Chapter 16 & 18: •Networking•Distributed File Systems
– Read ahead !