KEY TERMS, REVIEW QUESTIONS, AND PROBLEMS

Một phần của tài liệu Ebook Operating systems - Internals and designprinciples (9/E): Part 2 (Trang 43 - 47)

A key aspect of I/O is the use of buffers that are controlled by I/O utilities rather than by application processes. Buffering smoothes out the differences between the internal speeds of the computer system and the speeds of I/O devices. The use of buffers also decouples the actual I/O transfer from the address space of the appli- cation process. This allows the operating system more flexibility in performing its memory management function.

The aspect of I/O that has the greatest impact on overall system performance is disk I/O. Accordingly, there has been greater research and design effort in this area than in any other kind of I/O. Two of the most widely used approaches to improve disk I/O performance are disk scheduling and the disk cache.

At any time, there may be a queue of requests for I/O on the same disk. It is the object of disk scheduling to satisfy these requests in a way that minimizes the mechanical seek time of the disk and hence improves performance. The physical layout of pending requests plus considerations of locality come into play.

A disk cache is a buffer, usually kept in main memory, that functions as a cache of disk blocks between disk memory and the rest of main memory. Because of the principle of locality, the use of a disk cache should substantially reduce the number of block I/O transfers between main memory and disk.

11.12 KEY TERMS, REVIEW QUESTIONS, AND PROBLEMS Key Terms

block

block-oriented device buffer swapping circular buffer device I/O

direct memory access disk access time disk cache double buffering gap

interrupt-driven I/O input/output (I/O)

least frequently used (LFU) I/O buffer

I/O channel I/O processor logical I/O magnetic disk programmed I/O read/write head

redundant array of independent disks rotational delay sector

seek time

stream-oriented device stripe

track transfer time

Review Questions

11.1. List and briefly define three techniques for performing I/O.

11.2. What are the differences between a blocking I/O and a nonblocking I/O?

11.3. What is the difference between block-oriented devices and stream-oriented devices?

Give a few examples of each.

11.4. Why would you expect improved performance using a double buffer rather than a single buffer for I/O?

11.5. State some utilities of buffering.

11.6. Briefly define the disk scheduling policies illustrated in Figure 11.7.

11.7. Cite the differences between the implementation of hardware RAID and software RAID.

11.8. What is a Linux Elevator? Point out some problems associated with it.

Problems

11.1. Consider a program that accesses a single I/O device and compare unbuffered I/O to the use of a buffer. Show that the use of the buffer can reduce the running time by at most a factor of two.

11.2. Generalize the result of Problem 11.1 to the case in which a program refers to n devices.

11.3. Consider a disk drive with 4,000 cylinders, numbered from 0 to 3,999. The request queue has the following composition:

1045 750 932 878 1365 1787 1245 664 1678 1897 If the current position is 1167 and the previous request was served at 1250, compute the total distance (in cylinders) that the disk arm would move for each of the following algorithms: FIFO, SSTF, SCAN, and C-SCAN scheduling.

11.4. Consider a disk with N tracks numbered from 0 to (N - 1) and assume requested sectors are distributed randomly and evenly over the disk. We want to calculate the average number of tracks traversed by a seek.

a. Calculate the probability of a seek of length j when the head is currently positioned over track t. (Hint: This is a matter of determining the total number of combina- tions, recognizing that all track positions for the destination of the seek are equally likely.)

b. Calculate the probability of a seek of length K, for an arbitrary current position of the head. (Hint: This involves the summing over all possible combinations of movements of K tracks.)

c. Calculate the average number of tracks traversed by a seek, using the formula for expected value

E[x] = a

N-1

i=0i * Pr [x = i]

Hint: Use the equalitiesa

n

i=1 = n(n + 1)

2 ; a

n

i=1i2 = n(n + 1)(2n+ 1)

6 .

d. Show that for large values of N, the average number of tracks traversed by a seek approaches N/3.

11.5. It has been found that in a certain disk drive about 80% of all requests are for a small, fixed number of cylinders. Which of the scheduling algorithms will you recom- mend for this situation? Justify your choice.

11.6. In a single-user system, determine whether buffering, spooling, caching, or a combi- nation of these should be used for each of the following I/O scenarios:

a. A mouse used with a graphical user interface.

b. A tape drive on a multitasking OS.

c. A disk drive containing user files.

11.7. Calculate how much disk space (in sectors, tracks, and surfaces) will be required to store 250,000 200-byte logical records if the disk is fixed sector with 1024 bytes/

sector, with 108 sectors/track, 140 tracks per surface, and 12 usable surfaces. Ignore any file header record(s) and track indexes, and assume that records cannot span two sectors.

11.8. Consider the disk system described in Problem 11.7, and assume that the disk rotates at 1,200 rpm. A processor reads one sector from the disk using interrupt-driven I/O, with one interrupt every 4 bytes. If it takes 1.5 μs to process each interrupt, what percentage of the time will the processor spend handling I/O (disregard seek time)?

11.9. Repeat the preceding problem using DMA, and assume one interrupt per sector.

11.12 / keY terMS, reVIeW QueStIOnS, anD prOBleMS 549

11.10. A 32-bit computer has two selector channels and one multiplexor channel. Each selec- tor channel supports two magnetic disk and three magnetic tape units. The multiplexor channel has three line printers, two card readers, and twelve VDT terminals connected to it. Assume the following transfer rates:

Disk drive 1100 Kbytes/s

Magnetic tape drive 400 Kbytes/s

Line printer 7.8 Kbytes/s

Card reader 1.6 Kbytes/s

VDT 1.2 Kbyte/s

Estimate the maximum aggregate I/O transfer rate in this system.

11.11. A disk pack has the following specifications: it comprises 25 double sided disks; each surface of a disk has 480 tracks and a track has 20 blocks in it. Each block is of 2048 bytes, with an inter-block gap of 64 bytes.

Compute the total capacity of a track, the useful capacity of a track (excluding inter-block gap), the total capacity and useful capacity of a cylinder, the total capacity and useful capacity of the disk pack, and the percentage of space wasted.

11.12. In a certain device, the disk rotates at 7,500 rpm. What is the average rotational delay of this disk drive?

550

File Management

12.1 Overview

Files and File Systems File Structure

File Management Systems 12.2 File Organization and Access

The Pile

The Sequential File The Indexed Sequential File The Indexed File

The Direct or Hashed File 12.3 B-Trees

12.4 File Directories Contents Structure Naming 12.5 File Sharing

Access Rights Simultaneous Access 12.6 Record Blocking

12.7 Secondary Storage Management File Allocation

Free Space Management Volumes

Reliability 12.8 UNIX File Management

Inodes File Allocation Directories Volume Structure 12.9 Linux Virtual File System

The Superblock Object The Inode Object The Dentry Object The File Object Caches 12.10 Windows File System

Key Features of NTFS

NTFS Volume and File Structure Recoverability

12.11 Android File Management File System SQLite 12.12 Summary

12.13 Key Terms, Review Questions, and Problems

Chapter

Một phần của tài liệu Ebook Operating systems - Internals and designprinciples (9/E): Part 2 (Trang 43 - 47)

Tải bản đầy đủ (PDF)

(623 trang)