NETW 3005 Mass Storage (How discs work). Notice I was unaware just how much was missing in the printed notes. As a partial remedy for that, the lecture.

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

Mass-Storage Structure
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.
Operating Systems 1 K. Salah Module 5.0: I/O and Disks I/O hardware Polling and Interrupt-driven I/O DMA Bock and character devices Blocking and nonblocking.
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
Disk Drivers May 10, 2000 Instructor: Gary Kimura.
Mass-Storage Structure
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
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
04/21/2004CSCI 315 Operating Systems Design1 Disk Scheduling.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space.
Mass storage Structure Unit 5 (Chapter 14). Disk Structures Magnetic disks are faster than tapes. Disk drives are addressed as large one- dimensional.
1 Operating Systems Part VI: Mass- Storage Structure.
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.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13+14: I/O Systems and Mass- Storage Structure I/O Hardware Application I/O.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 12: Mass-Storage Systems Overview of Mass.
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.
1Fall 2008, Chapter 12 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
CS 6502 Operating Systems Dr. J.. Garrido Device Management (Lecture 7b) CS5002 Operating Systems Dr. Jose M. Garrido.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space.
Chapter 12: Mass-Storage Systems
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 10: Mass-Storage Structure.
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
Chapter 14: Mass-Storage Systems Disk Structure. Disk Scheduling. RAID.
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.
Part IV I/O System Chapter 12: Mass Storage Structure.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 11: File System Implementation.
Operating System (013022) Dr. H. Iwidat
Disks and RAID.
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Chapter 12: Mass-Storage Structure
I/O Resource Management: Software
Operating System I/O System Monday, August 11, 2008.
Disk Scheduling Algorithms
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
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
Secondary Storage Management Brian Bershad
Secondary Storage Management Hank Levy
CSE451 File System Introduction and Disk Drivers Autumn 2002
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:

NETW 3005 Mass Storage (How discs work)

Notice I was unaware just how much was missing in the printed notes. As a partial remedy for that, the lecture slides will appear on the web within the next week. NETW3005 (Operating Systems) Lecture 11 - How discs work/442

Reading For this lecture, you should have read Chapter 12 (Sections 1-4). NETW3005 (Operating Systems) Lecture 11 - How discs work/443

Last lecture: I/O systems Hardware: ports, buses, controllers Application I/O interface Kernel I/O services NETW3005 (Operating Systems) Lecture 11 - How discs work/444

This lecture: How disks work The mechanics of disks Disk scheduling Formatting and booting Disk reliability: bad blocks, RAIDs Swap space management NETW3005 (Operating Systems) Lecture 11 - How discs work/445

The mechanics of disks A disk drive consists of –a number of platters –with two surfaces each –arranged on a rotating spindle –with a head for each surface. NETW3005 (Operating Systems) Lecture 11 - How discs work/446

Some terminology A single disk platter has two surfaces. Each surface is organised into concentric circles called tracks. All tracks of the same radius form a cylinder. Each track is divided into sectors. A sector is the smallest addressable part of the disk. NETW3005 (Operating Systems) Lecture 11 - How discs work/447

The mechanics of disks NETW3005 (Operating Systems) Lecture 11 - How discs work/448

Addressing Information on the disk is referenced by a multi-part address which includes: –drive number, –cylinder number, –surface number and, –sector number. NETW3005 (Operating Systems) Lecture 11 - How discs work/449 Cylinders are vertically formed by tracks. In other words, track 12 on platter 0 plus track 12 on platter 1 etc. is cylinder 12. The number of cylinders of a disk drive exactly equals the number of tracks on a single surface in the drive.

Access time has two major components Seek time is the time taken to move the heads to the cylinder containing the desired sector. Rotational latency is the time taken to rotate the desired sector to the disk head.

More terminology The heads all move together, accessing a cylinder of the disk. To access a particular sector, the heads are moved to the appropriate cylinder, the correct head is enabled, and the head waits until the correct sector comes under it. NETW3005 (Operating Systems) Lecture 11 - How discs work/4411

Disk scheduling kernel’s I/O subsystem schedules pool of pending I/O requests. Imagine a queue of I/O requests to a given disk. Ordering these requests in different ways will result in different head seek times. NETW3005 (Operating Systems) Lecture 11 - How discs work/4412

Algorithms for disk scheduling Criteria for evaluating algorithms: –Seek time –Fairness (in particular, starvation) NETW3005 (Operating Systems) Lecture 11 - How discs work/ FCFS 2.Shortest seek-time first scheduling 3.SCAN 4.C SCAN 5.C LOOK

FCFS scheduling Treat I/O requests in FCFS order. NETW3005 (Operating Systems) Lecture 11 - How discs work/4414 Calculation of the seek time for the schedule given on the next slide ( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) = 640 cylinders Here we do not calculate the time but only the number of cylinders' the head is moving – that gives us the distance which is directly proportional to seek time i.e if the distance is increasing seek time is also increasing

NETW3005 (Operating Systems) Lecture 11 - How discs work/4415 Illustration shows total head movement of 640 cylinders.

Advantages and disadvantages? Advantages? –no starvation: every request is serviced –Simple to implement. Disadvantages? – big swing in head seek. NETW3005 (Operating Systems) Lecture 11 - How discs work/4416

Shortest seek-time first scheduling At any moment, choose the request with the shortest distance from the current head position. NETW3005 (Operating Systems) Lecture 11 - How discs work/4417

NETW3005 (Operating Systems) Lecture 11 - How discs work/4418 Illustration shows total head movement of 236 cylinders.

Advantages and disadvantages? Advantages? –You get much shorter seek times this way, because you’re eliminating the big swings. (At least, you’ll only get them if there’s nothing closer.) Disadvantages? –Starvation is a possibility. NETW3005 (Operating Systems) Lecture 11 - How discs work/4419 Seek time for SSTF is calculated as follows: ( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) = 236 this is some many cylinder movements not time

SCAN scheduling Start the disk at one end, and move right to the other end, servicing all the I/O requests you get to on your way. Then start in the other direction. NETW3005 (Operating Systems) Lecture 11 - How discs work/4420

NETW3005 (Operating Systems) Lecture 11 - How discs work/4421 Illustration shows total head movement of 208 cylinders.

( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) = 208

Advantages and disadvantages? Advantages? –Avoids starvation Disadvantages? –Requests for the middle of the disk are advantaged over those at the ends. NETW3005 (Operating Systems) Lecture 11 - How discs work/4423

C-SCAN scheduling Like SCAN, but when the head gets to one end, it goes straight to the other end without servicing any requests. NETW3005 (Operating Systems) Lecture 11 - How discs work/4424

NETW3005 (Operating Systems) Lecture 11 - How discs work/4425 C-SCAN scheduling

Advantages and disadvantages? Advantages? –No region of the disk are favored. Disadvantages? requires one long seek after finished going up have to go back to the beginning NETW3005 (Operating Systems) Lecture 11 - How discs work/4426 C-SCAN scheduling

C-LOOK scheduling Like C-SCAN, except that rather than going to the ends of the disk, we only go as far as the furthest request in each direction. NETW3005 (Operating Systems) Lecture 11 - How discs work/4427

NETW3005 (Operating Systems) Lecture 11 - How discs work/4428

Advantages and disadvantages? Advantages? –No region of the disk are favored Disadvantages? more inclined to serve the middle cylinder requests NETW3005 (Operating Systems) Lecture 11 - How discs work/4429

Comparison of Disk Scheduling Algorithms

Priority scheduling We might not want to treat all these requests as equal, e.g. page-fault- generated requests might need to be handled first. NETW3005 (Operating Systems) Lecture 11 - How discs work/4431

Selecting a Disk-Scheduling Algorithm FCFS- Ideal for LOW Load Disk Schedule. SSTF – ideal for Linked and indexed allocation technique to reduce the head seek time. SCAN and C-SCAN- ideal for heavy load on the disk. C – scan is ideal for contiguous allocation technique Either SSTF or LOOK reasonable choice for the default algorithm.

Where should index blocks be stored? Near the blocks containing the file’s data. NETW3005 (Operating Systems) Lecture 11 - How discs work/4433 Where should directories be stored? In the middle of the partition is a good idea, so you never have more than half the disk to scan. Or near the FAT. Best to cache recently-used directory info as well.

Disk formatting Low-level formatting: normally done in the factory. Creates the sectors on the disk, and fills each with an initial data structure: –A header and trailer, containing information used by the disk controller - e.g. sector number, error-correcting code (ECC). –A data area (usually 512 bytes). NETW3005 (Operating Systems) Lecture 11 - How discs work/4434 Header Sector No Data ( 512 bytes)Trailer( ECC)

Disk formatting Partitioning: done by the operating system. Logical formatting: making an (empty) file system. NETW3005 (Operating Systems) Lecture 11 - How discs work/4435 File System NTFSFAT 32

Bad blocks A bad sector is a sector on a computer's disk drive that cannot be used due to permanent damage. NETW3005 (Operating Systems) Lecture 11 - How discs work/4436 Bad blocks are blocked in the FAT – table The Controller maintains list of bad blocks and spare blocks right from Low Level formatting. Controller can replace each bad sector with one of the spare sector

Problems with sparing? Sector sparing could invalidate any optimization by the operating systems disk scheduling algorithm NETW3005 (Operating Systems) Lecture 11 - How discs work/4437 Sector slipping: shuffling all the data on disk to make room for the spare block right next to the one it’s replacing. Provision of spare sectors in each cylinders

Error recovery and RAIDs RAID is the organization of multiple disks into a large, high performance logical disk. Each block of data is broken into sub- blocks, with one sub-block stored on each disk. NETW3005 (Operating Systems) Lecture 11 - How discs work/4438

RAIDs Mirroring: each disk holds all the data. Block interleaved parity. A parity bit for the group of sub-blocks is written to a special parity block. If one of the sub- blocks is lost, it can be recovered from the other sub-blocks plus the parity block. NETW3005 (Operating Systems) Lecture 11 - How discs work/4439

=

Primary Boot strap loader Secondary boot loader LOADS THE OS INTO THE MAIN MEMORY LOADSLOADS Booting a system

Swap space management Swap space holds entire process or page or segment which Is swapped out to the backing store from main memory Swap space implementation File System swap space is simply a large file within file system Navigating takes more Time Special raw partition swap space Is Blocks in the raw partition Speed of access is better than file system Some OSs can swap in both file space and raw swap partitions, e.g. Solaris 2.

Next Lecture !Revision! Make sure you come along (Exam hints are possible)

Is SSTF optimal? No – it is too short-sighted, i.e. no look- ahead. It is possible to develop an optimal algorithm, but the time taken to calculate it means it’s not really worth it. For example if the head moves to 37 then 14 and then 65, 67 and so on seek time will be less ( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) + ( ) = 208 NETW3005 (Operating Systems) Lecture 11 - How discs work/4444

1 xor 1 = 0 1 xor 0 = 1 0 xor 0 = xor 1001 = 0111

7 bits of data (number of 1s) 8 bits including parity evenodd (0) (3) (4) (7)

Booting a system In fact, the initial program is often very small. Often it just loads a bigger bootstrap program, and this program does the rest. The program will be stored at a fixed location on the disk, called the boot block. NETW3005 (Operating Systems) Lecture 11 - How discs work/4447

Swap-space management memory management often uses a backing store to hold data from processes being multitasked. We could implement swap space simply as a file within a directory structure. Problems with this approach? NETW3005 (Operating Systems) Lecture 11 - How discs work/4448

Swap-space management A more frequent solution is to create a special partition for swap space. The disk allocation algorithm on this partition is optimised for speed, rather than memory efficiency. Some OSs can swap in both file space and raw swap partitions, e.g. Solaris 2. NETW3005 (Operating Systems) Lecture 11 - How discs work/4449