CPSC 410 / 611 : Operating Systems CPSC 410/ 611: “Week 9” • Disk St ruct ure • Disk Scheduling • RAI D • Disk Block Management • Reading: Silberschat z Chapt er 12 CPSC 410/ 611: “Week 9” • Disk St ruct ure • Disk Scheduling • RAI D • Disk Block Management • Reading: Silberschat z Chapt er 12 1
CPSC 410 / 611 : Operating Systems Disk St ruct ure sector Disk speed: cylinder • seek time : head moves to correct track • rotational delay : wait until sector is under head • transfer time : transfer data between track disk and memory Disk Perf ormance = + T S m n s ´ • Seek Time : T s n = number of t racks t raversed m = “t rack t raversal t ime” s = st art up t ime • Rot at ional Delay (Lat ency Time): T R r = # revolut ions per t ime unit 1 = T R • Transf er Time: T T 2 r b = # byt es t o be t ransf erred N = number of byt es on t rack b T T = rN • Disk Access Time: = + + T T T T S R T 2
CPSC 410 / 611 : Operating Systems CPSC 410/ 611: “Week 9” • Disk St ruct ure • Disk Scheduling • RAI D • Disk Block Management • Reading: Silberschat z Chapt er 12 Disk Scheduling application application file system device driver disk queue • Quest ion: Does it pay of f t o t hink about scheduling policy in disk queue? • Evaluat ion: Compare t ime f or service f or given request sequence, dist inguish only by cylinder. 3
CPSC 410 / 611 : Operating Systems FCFS Scheduling • Advant ages: – simple – f air • Disadvant ages – poor average service t ime • Example: 98, 183, 37, 122, 14, 124, 65, 67 0 24 49 74 99 124 149 174 199 total head movement: 640 tracks Short est -Seek-Time-First (SSTF) • Always service closest request . • P roblem: – St arvat ion 0 24 49 74 99 124 149 174 199 total head movement: 236 tracks 4
CPSC 410 / 611 : Operating Systems SCAN (Elevat or Algorit hm) • Cont inuously scan disk f rom one end t o t he ot her. • When scanning, f ew request s af t er us, since j ust past t hrough. • Problem: When we change direct ion at end, request s t here are very new. 0 24 49 74 99 124 149 174 total head movement: 236 C-SCAN (circular SCAN) • Reduce variance in service t ime by always st art ing at t he beginning of t he disk. 0 24 49 74 99 124 149 174 5
CPSC 410 / 611 : Operating Systems LOOK, C-LOOK 0 24 49 74 99 124 149 174 total head movement: 299 0 24 49 74 99 124 149 174 total head movement: 322 CPSC 410/ 611: “Week 9” • Disk St ruct ure • Disk Scheduling • RAI D • Disk Block Management • Reading: Silberschat z Chapt er 12 6
CPSC 410 / 611 : Operating Systems RAI D • Secondary st orage devices are slow! • I mprove t heir perf ormance by using mult iple devices in parallel: arrays of disks. • RAI D – Redundant Arrays of I ndependent Disks – Redundant Arrays of I nexpensive Disks (Berkeley) • Common charact erist ics: – Array of physical disks t hat are visible as single device t o OS. – Dat a is dist ribut ed across physical drives of array – Redundant disk capacit y is used f or error det ect ion/ correct ion RAI D (cont ) • Replace single large-capacit y disk wit h array of smaller -capacit y disks: • Benef it s: – I mproved I / O perf ormance – I ncrement al upgrade • Problems: – Reliabilit y: more devices increase t he probabilit y of f ailure. – Solut ion: redundancy = > = − λ t R ( t ) P [ t t ] e . g . R ( t ) e F ∞ ∫ = = [ ] ( ) MTTF E t R t dt F 0 7
CPSC 410 / 611 : Operating Systems RAI D Level 0 block • No Redundancy • St riping: Small strips blocks Large strips RAI D Level 1 • Adds redundancy t o Level 0: Mirroring • Problem: – cost (100% redundancy) • Perf ormance – READs : good (replicat ion!) – WRI TEs: not (much) bet t er t han RAI D mirrors 0. 8
CPSC 410 / 611 : Operating Systems RAI D Level 2 block • Head and spindles synchronized • Small st rips • Error correct ion code calculat ed over bis of dat a disks. (Hamming Code) • Appropriat e f or syst ems wit h many f ailures. • Typically not implement ed. RAI D Level 3 • Heads and spindles synchronized. • Small st rips. block • Simple parit y bit s inst ead of ECC. = = ⊕ ⊕ ⊕ e . g . P ( S ) S S S S S 4 3 2 1 0 Disk 1 fails: parity = ⊕ ⊕ ⊕ S S S S S 1 4 3 2 0 9
CPSC 410 / 611 : Operating Systems RAI D Level 4 • No synchronizat ion across disks. • Lar ge st r ips. block • Each st rip on parit y disk cont ains parit y inf ormat ion f or all corresponding st rips. = ⊕ ⊕ ⊕ X 4 ( i ) X 3 ( i ) X 2 ( i ) X 1 ( i ) X 0 ( i ) = ⊕ ⊕ ⊕ X 4 ' ( i ) X 3 ( i ) X 2 ( i ) X 1 ' ( i ) X 0 ( i ) = ⊕ ⊕ ⊕ ⊕ ⊕ X 3 ( i ) X 2 ( i ) X 1 ' ( i ) X 0 ( i ) X 1 ( i ) X 1 ( i ) = ⊕ ⊕ X 4 ( i ) X 1 ( i ) X 1 ' ( i ) CPSC 410/ 611: “Week 9” • Disk St ruct ure • Disk Scheduling • RAI D • Disk Block Management • Reading: Silberschat z Chapt er 12 10
CPSC 410 / 611 : Operating Systems Disk Format t ing • Bare disk: • Physical f ormat t ing: • “cut ” int o sect ors • ident if y sect ors • add space f or error det ect ion/ correct ion 1 ecc 2 ecc 3 ecc 4 ecc 5 ecc X ecc • Logical f ormat t ing: • add blank direct ory, FAT, f ree space list , ... 1 FAT 2 DIR 3 DIR 4 F/L 5 ... X Framing • Charact er count • St art ing and ending chars, wit h charact er st uf f ing charact er count DLE STX a b DLE DLE c DLE ETX 5 1 2 3 4 8 1 2 3 4 5 6 7 2 1 st uf f ed DLE • St art ing and ending f lags, wit h bit • Physical layer coding violat ions st uf f ing f raming pat t ern: 01111110 binary Manchest er 011011111 0 11111 0 11111 0 10010 st uf f ed bit s lack of t ransit ion 11
CPSC 410 / 611 : Operating Systems Bad Block Management • One or more blocks become unreadable/ unwrit eable: bad blocks • Of f -line management of bad blocks: – Run bad-block det ect ion program and put bad blocks on bad-block list . (Eit her remove t hem f rom f ree list or mark ent ry in FAT.) – May have t o run f ile recovery ut ilit y. • On-line management : – Have t he device driver map t he bad block ont o a good block – Block X goes bad. Whenever OS request s block X , t he disk t ransparent ly accesses a replacement block Y . – Problem: scheduling! 12
Recommend
More recommend