Presentation is loading. Please wait.

Presentation is loading. Please wait.

I/O and Disk Scheduling CS 470 - Spring 2002. Overview Review of I/O Techniques I/O Buffering Disk Geometry Disk Scheduling Algorithms RAID.

Similar presentations


Presentation on theme: "I/O and Disk Scheduling CS 470 - Spring 2002. Overview Review of I/O Techniques I/O Buffering Disk Geometry Disk Scheduling Algorithms RAID."— Presentation transcript:

1 I/O and Disk Scheduling CS 470 - Spring 2002

2 Overview Review of I/O Techniques I/O Buffering Disk Geometry Disk Scheduling Algorithms RAID

3 Review Input / Output techniques –Programmed I/O –Interrupt Driven I/O –Direct Memory access I/O Layering –Application –Device Independent I/O –Driver –Interrupt Service Routine

4 I/O Buffering Advantages –Overlap I/O and computation –Separates I/O from computation e.g. I/O can occur even if buffer is swapped Time measurement parameters –T = I/O transfer time –C = computation time –M = block move time Effect of buffering on program performance

5 No Buffers: T + C Disk User Copy CPU T Disk User Copy CPU C

6 One Buffer: max(T, C) + M System Buffer Disk User Copy CPU System Buffer Disk User Copy CPU T C M

7 Two Buffers: max(T, C + M) System Buffer 1 Disk User Copy CPU T C System Buffer 2 User Copy CPU M System Buffer 2

8 I/O Buffering Summary Buffering Alternatives –No buffering: T + C –Single buffer: max(T, C) + M –Double buffer: max(T, C + M) –Circular buffers: smooths out I/O demand Disk cache - analogy to memory management –Fetch Policy - read ahead –Replacement choice: LRU, LFU, FIFO –When to do these: On demand or preplanned.

9 Classic Disk Geometry Disk medium is a number of platters fixed to a axle spinning at high speed. There is one read/write head for each surface of each platter. Heads are attached to an arm which varies by discrete amounts the distance to the axle of all heads simultaneously. For each position of the arm, a head describes a circular track as the disk spins. Track is divided into segments called sectors which hold the data.

10 Disk Layout Sector Track Intersector Gap Intertrack Gap

11 Disk Performance Seek time: time to move arm to right cylinder. Roughly linear in nbr. of tracks crossed: #tracks  Trk2Trk + Startup. Average is seek over half the tracks. Rotational delay: time to spin around to right sector on track Access time: seek time + rotational delay Transfer speed: how fast data spins past the head Rotational speed and average seek time determine these parameters

12 Retail $100 IDE Disk Drive Geometry –8 platters (16 surfaces, 16 heads, 1 arm) –7763 cylinders (7763 tracks per surface) –63 sectors of 512 bytes each per track –Total: 16  7763  63  512 bytes = 3913 MB Performance –Avg seek: 11 ms, Rotational speed: 5400 rpm –Avg rot. delay: 0.5/5400 min = 5.5 ms –Avg access time: 11 + 5.5 = 16.5 ms –trans speed: 63  5400  512 b/m = 2.8 MB/sec

13 Disk Scheduling Algorithms FIFO - simple and fair Priority LIFO - serve current process well Shortest service time first (SSTF) SCAN - Back and forth over disk C-SCAN - unidirectional scan N-step SCAN - N jobs per queue FSCAN - 2 queues

14 FIFO, Priority, and LIFO Disk Enter Disk Enter Disk Enter

15 Shortest Service Time Next 23 Disk Jobs Entered In Sorted Order 271115 10 Current Location Select Closest Job Starvation when arm is stuck in one area for extended period Numbers are Disk locations of data

16 Scan (Bidirectional) 23 Disk Jobs Entered In Sorted Order 271115 10 Current Location Scan Left to Right, Then Right to Left Uneven response time at ends of disk

17 C-Scan (Unidirectional) 23 Disk Jobs Entered In Sorted Order 271115 10 Current Location Scan Left to Right, Then Return to left Can Still Exhibit Starvation

18 N-step-Scan 23 Disk 271115 Jobs entered in sorted groups of N jobs Groups Serviced In FIFO Order Case where N = 1 is FIFO

19 F-Scan 23 Disk 271115 Jobs Queued in Sorted Order Roles of two groups swapped when current group of jobs serviced. Queue Group Dequeue Group

20 Basic Disks Master boot record (MBR) –Located on first sector of primary drive –Boot code –Partition Table (Up to 4 Entries) Location and size of partition File system type (e.g. FAT32, NTFS) Extended Partition is a file system type –Recursively contains MBR and Partitions itself Partitions –File System begins with boot sector

21 Dynamic Disks (1 of 2) Logical Disk Manager (LDM) Database –Single database for all drives – includes multipartition volume descriptions –Replicated with one copy on each dynamic drive –1 MB in size, located at end of drive Master Boot Record (MBR) –Describes System and Boot partitions –If none, single partition from MBR to LDM –Boot and legacy software can’t read LDM

22 Dynamic Disks (2 of 2) LDM Structure –Private Header GUID for dynamic drive and disk group name Replicated at end of LDM –Table of Contents –128 byte database records Entries all have name and id Partitions: size, offset, disk id, parent component Components: parent volume (2 for mirrors) Volume: size, state, GUID, drive hint Disk: GUID –Transactional Log

23 RAID Redundant Array of Independent Disks Six flavors –Level 0: Disk striping –Level 1: Disk mirroring –Level 2: Small strips, ECC e.g. Hamming –Level 3: Small strips with parity –Level 4: Large strips, fixed parity drive –Level 5: Large strips, round robin parity Disk Spanning (not RAID)

24 Striping and Mirroring 15 10 5 0 16 11 6 1 17 12 7 2 18 13 8 3 19 14 9 4 3 2 1 0 3 2 1 0 Mirroring Provides Data Redundancy at cost of doubling number of drives Has Fast Read Access Stripes are fast; but not redundant

25 Raid Levels 2 and 3 15 10 5 0 17 12 7 2 19 14 9 4 C C C C C C C C 16 11 6 1 18 13 8 3 Disk arms are in lock step; each access involves all disk drives. Fast access for large individual jobs - high overhead for many small I/O’s. Level 2 avoided because of added cost. Small Byte-sized StripsRedundancy

26 Raid Levels 4 and 5 15 10 5 0 17 12 7 2 19 14 9 4 P P P P 16 11 6 1 18 13 8 3 Large Strips with Parity Strip 15 10 5 P 17 P 6 1 18 13 8 3 19 14 9 4 16 11 P 0 P 12 7 2 Single drive for parity stays very busy Round robin parity

27 RAID Level 4 and 5 Redundancy Principle – Bit values for parity drive are sum mod 2 of the corresponding bits on other drives When a block is changed, the new parity can be computed in terms of the old value of the parity: –new parity = sum of old & new value and old parity bit modulo 2 –So one write requires: 2 reads and 2 writes Reading requires just one read

28 RAID 5 Sector Calculation Assume: – RAID 5 with k drives and sector sized strips – Sector/Drive numbers zero based Effective capacity is k-1 times the size of a single drive RAID logical sector N location: –R = N % (k * (k - 1)) –Drive = R%(k-1) + ((R%(k-1)>=R/(k-1)) ? 1 : 0) –Sector = N / (k - 1) –Parity Drive = R / (k – 1)


Download ppt "I/O and Disk Scheduling CS 470 - Spring 2002. Overview Review of I/O Techniques I/O Buffering Disk Geometry Disk Scheduling Algorithms RAID."

Similar presentations


Ads by Google