⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 solution13-14.txt

📁 operating system concepts sixth edition windows XP updat 操作系统课后答案
💻 TXT
字号:
------------------------------------------------------------------------------
Question 13.2:

Consider the following I/O scenarios on a single-user PC.

  a. A mouse used with a graphical user interface.
  b. A tape drive on a multitasking operating system (assume no device
     preallocation is available).
  c. A disk drive containing user files.
  d. A graphics card with direct bus connection, accessible through
     memory-mapped I/O.

For each of these I/O scenarios, would you design the operating system:
        to use buffering, spooling, caching, or a combination?
        Would you use polled I/O, or interrupt-driven I/O?
        Give reasons for you choices.

Answer:
  a.    - Buffering may be needed to record mouse movement during times
          when higher priority operations are taking place.
        - Spooling and caching are inappropriate.
        - Interrupt driven I/O is most appropriate.

  b.    - Buffering may be needed to manage throughput difference between the
          tape drive and the source or destination if the I/O.
        - Caching can be used to hold copies of data that resides on the tape,
          for faster access.
        - Spooling could be used to stage data to the device when multiple
          users desire to read from or write to it.
        - Interrupt driven I/O is likely to allow the best performance.
  c.    - Buffering can be used to hold data while in transit from user space l
          to the disk, and visa versa.
        - Caching can be used to hold disk-resident data for improved
          performance.
        - Spooling is not necessary because disks car shared-access devices.
        - Interrupt driven I/O is best for devices such as disks that transfer
          data at slow rates.
  d.    - Buffering may be needed to control multiple access and for
          performance (double-buffering can be used to hold the next screen
          image while displaying the current one).
        - Caching and spooling are not necessary due to the fast and
          shared-access natures of the device.
        - Polling and interrupt are only useful for input and for I/O
          completion detection, neither of which is needed for a memory-mapped
          device.

------------------------------------------------------------------------------
Question 13.5:
        Why might a system use interrupt-driven I/O to manage a single serial
        port but polling I/O to manage a front-end processor, such as a terminal
        concentrator?

Answer:
        Polling can be more efficient than interrupt-driven I/O. This is the
        case when the I/O is frequent and of short duration. Even though a
        single serial port will perform I/O relatively infrequently and should
        thus use interrupts, a collection of serial ports such as those in a
        terminal concentrator can produce a lot of short I/O operations, and
        interrupting for each one could create a heavy load on the system. A
        well-timed polling loop could alleviate that load without wasting many
        resources through looping with no I/O needed.

------------------------------------------------------------------------------

Question 13.8:
        How does DMA increase system concurrency? How does it complicate
        hardware design?

Answer:
        DMA increases system concurrency by allowing the CPU to perform tasks
        while the DMA system transfers data via the system and memory busses.
        Hardware design is compli-cated because the DMA controller must be
        integrated into the system, and the system must allow the DMA
        controller to be a bus master. Cycle stealing may also be necessary
        to allow the CPU and DMA controller to share use of the memory bus.

------------------------------------------------------------------------------

Question 13.10:
        Why is it important to scale up system bus and device speeds as the CPU
        speed increases?

Answer:
        Consider a system which performs 50% I/O and 50% CPU. Doubling the
        CPU performance on this system would increase the total system
        performance gy only 50%. Doubling both system aspects would
        increase performance by 100%. Generally it is important to remove
        the current system bottleneck, and to increase overall system
        performance rather than blindly increasing the performance of
        individual system components.
------------------------------------------------------------------------------

Question 14.2:
  Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The
  drive is currently serving a request at cylinder 143, and the previous
  request was at cylinder 125. The queue of pending requests, in FIFO
  order, is

        86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130

  Starting from the current head position, what is the total distance
  (in cylinders) that the disk arm moves to satisfy all the pending
  requests, for each of the following disk-scheduling algorithms?

    a. FCFS
    b. SSTF
    c. SCAN
    d. LOOK
    e. C-SCAN

Answer:
    a. The FCFS schedule is
          143, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130.
       The total seek distance is 7081.

    b. The SSTF schedule is
          143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774.
       The total seek distance is 1745.

    c. The SCAN schedule is
          143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86.
       The total seek distance is 9769.

    d. The LOOK schedule is
           143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86.
       The total seek distance is 3319.

    e. The C-SCAN schedule is
          143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 86, 130.
       The total seek distance is 9813.

    f. The C-LOOK schedule is
           143, 913, 948, 1022, 1470, 1509, 1750, 1774, 86, 130.
        The total seek distance is 3363.

------------------------------------------------------------------------------
Question 14.9:

Explain why SSTF scheduling tends to favor accesses to middle cylinders over 
the innermost and outermost cylinders.


Answer: The center of the disk is the location having the smallest average 
distance to all other tracks. Thus the disk head tends to move away from the
edges of the disk. Here is another way to think of it. The current location 
of the head divides the cylinders into two groups. If the head is not in the 
center of the disk and a new request arrives, the new request is more likely 
to be in the group that includes the center of the disk;, thus, the head is 
more likely to move in that direction. 


------------------------------------------------------------------------------
Question 14.20:

Discuss the relative advantages and disadvantages of sector sparing and sector
slipping

Sector sparing can cause an extra track switch and rotational latency, causing 
an unlucky request to require an extra 8 ms of time. Sector slipping has less 
impact during future reading, but at sector remapping time it can require the 
reading and writing of an entire track's worth of data to slip the sectors 
past the bad spot. 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -