Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 NETW 3005 Mass Storage (How discs work)

2 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

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

4 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

5 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

6 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

7 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

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

9 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.

10 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.

11 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

12 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

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

14 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 (98 - 53) + (183 - 98) + (183 - 37) + (122 - 37) + (122 - 14) + (124 - 14) + (124 - 65) + (67 - 65) = 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

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

16 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

17 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

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

19 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: (65 - 53) + (67 - 65) + (67 - 37) + (37 - 14) + (98 - 14) + (122 - 98) + (124 - 122) + (183 - 124) = 236 this is some many cylinder movements not time

20 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

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

22 (53 - 37) + (37 - 14) + (65 - 14) + (67 - 65) + (98 - 67) + (122 - 98) + (124 - 122) + (183 - 124) = 208

23 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

24 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

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

26 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

27 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

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

29 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

30 Comparison of Disk Scheduling Algorithms

31 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

32 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.

33 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.

34 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)

35 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

36 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

37 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

38 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

39 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

40 10011100 01101100 11110000 10011100=01101100

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

42 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.

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

44 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 (53 - 37) + (37 - 14) + (65 - 14) + (67 - 65) + (98 - 67) + (122 - 98) + (124 - 122) + (183 - 124) = 208 NETW3005 (Operating Systems) Lecture 11 - How discs work/4444

45 1 xor 1 = 0 1 xor 0 = 1 0 xor 0 = 0 1110 xor 1001 = 0111

46 7 bits of data (number of 1s) 8 bits including parity evenodd 0000000 (0)0000000010000000 1010001 (3)1101000101010001 1101001 (4)0110100111101001 1111111 (7)1111111101111111

47 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

48 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

49 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


Download ppt "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."

Similar presentations


Ads by Google