1 Recitation 8 Disk & File System. 2 Disk Scheduling Disks are at least four orders of magnitude slower than main memory –The performance of disk I/O.

Slides:



Advertisements
Similar presentations
Silberschatz, Galvin and Gagne Operating System Concepts Disk Scheduling Disk IO requests are for blocks, by number Block requests come in an.
Advertisements

Disks Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD hard disk.
I/O Management and Disk Scheduling Chapter 11. I/O Driver OS module which controls an I/O device hides the device specifics from the above layers in the.
I/O Management and Disk Scheduling
Faculty of Information Technology Department of Computer Science Computer Organization Chapter 7 External Memory Mohammad Sharaf.
RAID Redundant Array of Independent Disks
CS 6560: Operating Systems Design
Disk Scheduling Based on the slides supporting the text 1.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.
Lecture 36: Chapter 6 Today’s topic –RAID 1. RAID Redundant Array of Inexpensive (Independent) Disks –Use multiple smaller disks (c.f. one large disk)
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Other Disk Details. 2 Disk Formatting After manufacturing disk has no information –Is stack of platters coated with magnetizable metal oxide Before use,
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
File System Implementation
Based on the slides supporting the text
Disks.
1 Disk Scheduling Chapter 14 Based on the slides supporting the text.
12: IO Systems1 I/O SYSTEMS This Chapter is About Processor I/O Interfaces: Connections exist between processors, memory, and IO devices. The OS must manage.
Disks CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
12.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 12: Mass-Storage Systems.
Disk and I/O Management
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Storage Systems.
CSE 321b Computer Organization (2) تنظيم الحاسب (2) 3 rd year, Computer Engineering Winter 2015 Lecture #4 Dr. Hazem Ibrahim Shehata Dept. of Computer.
1 File System Implementation Operating Systems Hebrew University Spring 2010.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
Lecture 9 of Advanced Databases Storage and File Structure (Part II) Instructor: Mr.Ahmed Al Astal.
1 Lecture 8: Secondary-Storage Structure 2 Disk Architecture Cylinder Track SectorDisk head rpm.
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
Page 110/12/2015 CSE 30341: Operating Systems Principles Network-Attached Storage  Network-attached storage (NAS) is storage made available over a network.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 12: Mass-Storage.
CE Operating Systems Lecture 20 Disk I/O. Overview of lecture In this lecture we will look at: Disk Structure Disk Scheduling Disk Management Swap-Space.
I/O Management and Disk Structure Introduction to Operating Systems: Module 14.
Disks Chapter 5 Thursday, April 5, Today’s Schedule Input/Output – Disks (Chapter 5.4)  Magnetic vs. Optical Disks  RAID levels and functions.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space.
Chapter 12 – Mass Storage Structures (Pgs )
1.  Disk Structure Disk Structure  Disk Scheduling Disk Scheduling  FCFS FCFS  SSTF SSTF  SCAN SCAN  C-SCAN C-SCAN  C-LOOK C-LOOK  Selecting a.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 13 Mass-Storage Systems Slide 1 Chapter 13 Mass-Storage Systems.
Chapter 14: Mass-Storage Systems Disk Structure. Disk Scheduling. RAID.
CS399 New Beginnings Jonathan Walpole. Disk Technology & Secondary Storage Management.
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
1 Chapter 13 Mass-Storage Structure. 2 Disk Structure Disk drives are addressed as large 1- dimensional arrays of logical blocks, where the logical block.
M ASS S TORAGE S TRUCTURES Lecture: Operating System Concepts Lecturer: Pooja Sharma Computer Science Department, Punjabi University, Patiala.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
Part IV I/O System Chapter 12: Mass Storage Structure.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 9: Mass-Storage Systems.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
Magnetic Disks Have cylinders, sectors platters, tracks, heads virtual and real disk blocks (x cylinders, y heads, z sectors per track) Relatively slow,
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 11: File System Implementation.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems DISK I/0.
Chapter 10: Mass-Storage Systems
Multiple Platters.
Disks and RAID.
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Operating System I/O System Monday, August 11, 2008.
Mass-Storage Structure
DISK SCHEDULING FCFS SSTF SCAN/ELEVATOR C-SCAN C-LOOK.
Lecture 45 Syed Mansoor Sarwar
Chapter 14 Based on the slides supporting the text
Chapter 12: Mass-Storage Systems
Moving-head Disk Machanism
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Overview Continuation from Monday (File system implementation)
Disks and scheduling algorithms
Mass-Storage Systems.
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Presentation transcript:

1 Recitation 8 Disk & File System

2 Disk Scheduling Disks are at least four orders of magnitude slower than main memory –The performance of disk I/O is vital for the performance of the computer system as a whole –Access time (seek time + rotational delay) >> transfer time for a sector –Therefore the order in which sectors are read matters a lot Disk scheduling –Usually based on the position of the requested sector rather than according to the process priority –Possibly reorder stream of read/write request to improve performance

3 Disk Scheduling (Cont.) Several algorithms exist to schedule the servicing of disk I/O requests. We illustrate them with a request queue (tracks 0-199). 98, 183, 37, 122, 14, 124, 65, 67 Head pointer 53

4 FCFS Illustration shows total head movement of 640 cylinders.

5 SSF (Shortest Seek First) Selects the request with the minimum seek time from the current head position. SSF scheduling is a form of SJF scheduling; may cause starvation of some requests. Illustration shows total head movement of 236 cylinders.

6 SSF (Cont.)

7 SCAN (Elevator 1) The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues. Sometimes called the elevator algorithm. Illustration shows total head movement of 208 cylinders.

8 SCAN (Cont.)

9 C-SCAN (Elevator 2) Provides a more uniform wait time than SCAN. The head moves from one end of the disk to the other. servicing requests as it goes. When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip. Treats the cylinders as a circular list that wraps around from the last cylinder to the first one.

10 C-SCAN (Cont.)

11 Sample Question 1 [20], 10, 22, 20, 2, 40, 6, 38 –6 ms /per cylinder. (FCFS) [20], 10, 22, 20, 2, 40, 6, 38 – = 146 cylinders= 876 msec. (SSR) [20] 20, 22, 10, 6, 2, 38, 40 – = 60 cylinders = 360 msec. (Elevator 1) [20] 22, 38, 40, 10, 6, 2 – = 58 cylinders = 348 msec. (Elevator 2) [20] 22, 38, 40, 0, 2, 6, 10 –( ) cylinders = 420 msec

12 RAID Redundant Array of Inexpensive Disks (RAID) –A set of physical disk drives viewed by the OS as a single logical drive –Replace large-capacity disks with multiple smaller- capacity drives to improve the I/O performance (at lower price) –Data are distributed across physical drives in a way that enables simultaneous access to data from multiple drives –Redundant disk capacity is used to compensate for the increase in the probability of failure due to multiple drives Improve availability because no single point of failure Six levels of RAID representing different design alternatives

13 RAID Level 0 Does not include redundancy Data is stripped across the available disks –Total storage space across all disks is divided into strips –Strips are mapped round-robin to consecutive disks –A set of consecutive strips that maps exactly one strip to each disk in the array is called a stripe Can you see how this improves the disk I/O bandwidth? What access pattern gives the best performance? strip 0 strip 3 strip 2 strip 1 strip 7strip 6strip 5strip 4... stripe 0

14 RAID Level 1 Redundancy achieved by duplicating all the data Every disk has a mirror disk that stores exactly the same data –A read can be serviced by either of the two disks which contains the requested data (improved performance over RAID 0 if reads dominate) –A write request must be done on both disks but can be done in parallel –Recovery is simple but cost is high strip 0 strip 1 strip 2 strip 3 strip 2...

15 RAID Levels 2 and 3 b0 b1 b2P(b) X2(i) = P(i)  X1(i)  X0(i) Parallel access: all disks participate in every I/O request Small strips (1 bit) since size of each read/write = # of disks * strip size RAID 2: 1-bit strips and error-correcting code. ECC is calculated across corresponding bits on data disks and stored on O(log(# data disks)) ECC disks Hamming code: can correct single-bit errors and detect double-bit errors Example configurations data disks/ECC disks: 4/3, 10/4, 32/7 Less expensive than RAID 1 but still high overhead – not needed in most environments RAID 3: 1-bit strips and a single redundant disk for parity bits P(i) = X2(i)  X1(i)  X0(i) On a failure, data can be reconstructed. Only tolerates one failure at a time

16 Disk Hardware (3) Raid levels 0 through 2 Backup and parity drives are shaded

17 Disk Hardware (4) Raid levels 3 through 5 Backup and parity drives are shaded

18 RAID Levels 4 and 5 RAID 4 –Large strips with a parity strip like RAID 3 –Independent access - each disk operates independently, so multiple I/O request can be satisfied in parallel –Independent access  small write = 2 reads + 2 writes –Example: if write performed only on strip 0: P’(i) = X2(i)  X1(i)  X0’(i) = X2(i)  X1(i)  X0’(i)  X0(i)  X0(i) = P(i)  X0’(i)  X0(i) –Parity disk can become bottleneck RAID 5 –Like RAID 4 but parity strips are distributed across all disks strip 0 P(0-2) P(3-5) strip 3 strip 2 strip 1 strip 5strip 4

19 Sample Question 2 T s-b is the time to read a sector to a buffer from a rotating disk. T b-MM is the time to empty a sectors of data from the buffer into MM. (The average rate into the buffer must equal the average rate out of the buffer.) What is the maximum rate of data into the MM, given as the number of sectors read into the MM in time Ts-b in each of the following cases. Also give the degree of interleaving in each case. a) If T b-MM = T s-b and single buffering is used b) If T b-MM = T s-b and double buffering is used c) If T b-MM = 2T s-b and single buffering is used d) If T b-MM = 2T s-b and double buffering is used

20 Sample Question 2 a) If T b-MM = T s-b and single buffering is used –Rate = 1 sector / 2 T s-b, single interleaving b) If T b-MM = T s-b and double buffering is used –Rate = 1 sector / T s-b, zero interleaving c) If T b-MM = 2T s-b and single buffering is used –Rate = 1 sector / 3 T s-b, double interleaving d) If T b-MM = 2T s-b and double buffering is used –Rate = 1 sector / 2 T s-b, single interleaving

21 UNIX File i-nodes

22 Implementing Files (4) An example i-node

23 Tree-Structured Directories

24 Sample question 3 (Figure in previous slide). An I-node contains single indirect block & 10 direct addresses of 4 bytes each and all disk blocks are 1024B. What is the largest possible file. –The indirect block can hold 256 disk addresses. –Together with the 10 direct disk addresses, the maximum file has 266 blocks. –Since each block is 1 KB, the largest file is 266 KB.

25 Sample Question 4 What would happen if the bitmap or Free list containing the information about free disk blocks was completely lost due to a crash? Is there any way to recover from this disaster or is it bye-bye disk? Discuss your answer for UNIX and the FAT-16 file system. –It is not a serious problem at all. Repair is straightforward; it just takes time. –The recovery algorithm is to make a list of all the blocks in all the files and take the complement as the new free list. –In UNIX this can be done by scanning all the i-nodes. –In the FAT file system, the problem cannot occur because there is no free list. But even if there were, all that would have to be done to recover it is to scan the FAT looking for free entries.

Sample question 5 A certain file system uses 2-KB disk blocks. The median file size is 1KB. (a) If all files were exactly 1KB, what fraction of the disk space would be wasted? (b) Do you think the wastage for a real file system will be higher than this number or lower? Answer: If all files were 1 KB, then each 2-KB block would contain one file and 1 KB of wasted space. Trying to put two files in a block is not allowed because the unit used to keep track of data is the block, not the semiblock. This leads to 50 percent wasted space. In practice, every file system has large files as well as many small ones, and these files use the disk much more efficiently. For example, a 32,769-byte file would use 17 disk blocks for storage, given a space efficiency of 32768/34816, which is about 94 percent. 26

Sample question 6 A floppy disk has 40 cylinders. A seek takes 6ms/cyl moved. If no attempt is made to put the blocks of a file close to each other, 2 blocks that are logically consecutive will be about 13 cyl.s apart, on the avg. If, however, OS makes an attempt, the mean interblock distance can be reduced to 2 cyl.s. How long does it take to read a 100- block file in bothe cases, if the rotational latency is 100ms & the transfer time is 25ms/block. Answer: The time per block is built up of three components: seek time, rotational latency, and transfer time. In all cases the rotational latency plus transfer time is the same, 125 msec. Only the seek time differs. For 13 cylinders it is 78 msec; for 2 cylinders it is 12 msec. Thus for randomly placed files the total is 203 msec, and for clustered files it is 137 msec. 27