CS 505, Operating Systems Concepts

Test 2, 2 November 2004 - Device Management


  1. A colleague of yours believes it doesn't make sense to have a device that uses DMA and requires polling. What do you think? Explain.


    Your colleague is more or less correct. DMA removes the OS from data transfers involving the device; polling involves the OS with device-status checking.


  2. What is the principle structural difference between a device driver for an interrupt-capable device and one that requires polling?


    Essentially, there is none. Both are interrupt driven, although using different interrupts. Polling requires that devices be tested, but that's not a major structural difference, and it's usually not the responsibility of the device driver. Figure 5.8 in the text shows a Device Status Table for the interrupt-driven device driver, but the polling device driver needs such a table too because it must also store request information between executions. The polling device driver needs a device handler, and it also needs the function of the interrupt handler, although those functions are not invoked in the same as they are for an interrupt-driven device driver.


  3. Suppose you are buying a device for your system, and the device controller has no buffer space of its own. What operational characteristics of the device would you look at to determine if the absence of on-device buffers is acceptable? Explain.


    Ideally, the device should have DMA; then it can use all of physical memory (or those parts allowed by the OS) as a buffer. In the absence of DMA, the OS is responsible for device data transfer, so it would be helpful if the device was slow, which lowers the fraction of time over an interval the OS spends tending to the device, as well as making precise timing constraints less important. For similar reasons, the device should work with small data units. It is desirable that the device support interrupts, but this us a universally desirable characteristic (subject to dollar costs) and not specific to the presence or absence of on-device buffers.


  4. One way to avoid deadlock over shared resources is impose an order on the way threads can acquire the resources. Suppose resource acquisition is ordered R1 and then R2 and the shared resources are accessed in a loop, such as,

    while true
      access R1
      access R2
       

    Under theses circumstances, does resource ordering still prevent deadlock? Explain.


    It does, as long as a process releases both resources by the time an iteration ends.



This page last modified on 14 November 2004.