Test 2 - Resource Management

CS 438, Operating Systems Concepts


  1. Thread schedulers are dedicated to managing only the CPU. Explain the conditions under which it make sense for the resource managers and thread schedulers to communicate with each other.


    If the thread scheduler is able to divine the types of non-CPU recourses required by a program, it could bias its program selection towards the programs that require under-used resources, or at least avoid selecting programs that require heavily used resources. The information about current resource load would come from the resource manager.

    Most answers to this question were correct, but several answers resorted to special-purpose systems (real-time or embedded, usually), which wasn't necessary to answer the question.


  2. Some operating systems provide try-take(), a conditional version of the take() binary-semaphore operation. Rather than blocking when s is false, s.try-take() returns false to indicate that s is unavailable; when s is available, s.try-take() returns true to indicate the calling process has seized s.

    One motivation for implementing try-take() is to allow optimizations not possible with take(). Give an example of such an optimization.


    There are two main optimizations, one at application level and the other at system level. At the application level, try-take() allows an application to do other things while it waits for a semaphore to become available; the penalty for such concurrency is increasing the chance that some other process will grab the semaphore.

    At the system level, checking to the semaphore for availability is a read-only operation, and can be performed in a way that doesn't require entry into the kernel (which is not to suggest it's an unprotected operation). Once try-get() determines that the semaphore is available, it can then enter the kernel and actually try for the semaphore.

    Most answers described the process non-blocking optimization; none described the kernel optimization.


  3. The General Tape-Drive Problem is the same as the Tape-Drive Problem presented in class, but the system has n > 1 tape drives instead of 5 tape drives. Describe a resource-allocation scheme based on The Banker's Algorithm that implements a deadlock- (and livelock-) free solution to the General Tape-Drive Problem. Your solution should allow for maximum possible concurrency.


    Each process has an possible maximum allocation of two tape drives. Under the Banker's Algorithm, the last available tape drive would be allocated to a process that already has one tape drive, ensuring process to at least that process.

    Most of the answers for this question got the general idea, but botched the details. In particular, it's not necessary to make sure two tape drives are always in reserve as long as the algorithm allocates the last tape drive as described above.


  4. Given a uniprocessor system, explain whether or not makes sense to use devices that support neither DMA nor interrupts.


    It does not, because the CPU has to take responsibility for managing the devices, which represents an overhead that can be avoided by using DMA and interrupts.

    Most answers to this question were correct.



This page last modified on 2 November 2003.