Written assignment #1

This assignment is meant to help you prepare for the midterm. You don't have to turn in this assignment (and we will not grade it even if you do). We will not post the solution either. And in fact there are no precisely correct solutions for some questions. The main idea is to test whether you can approach those questions with innovative (but not wrong) thoughts. You are encouraged to discuss solutions with your fellow students or with us. Note that this set of questions are not meant to be complete for your midterm preparation. In particular, it does NOT replace the need of reviewing lecture notes.

  1. Under what circumstance would a user be better off using a time-sharing system, rather than a single-user PC?
  2. The OS is a resource manager. Is it really necessary to efficiently use computing resources for a single-user PC with a 2GHz processor?
  3. What are the differences between hardware interrupts, software traps, and system calls?
  4. Writing an operating system that can operate without interference from malicious or buggy user programs requires hardware assistance. Name three hardware aids for writing an operating system, and describe how they are useful to protect the operating system.
  5. What is the main advantage of layered operating system design?
  6. What is the main advantage of the microkernel operating system design?
  7. Describe the performance cost for thread and process context switching.
  8. What resources are required to create a process?
  9. What resources are required to create a thread? Why or how is this different than process creation?
  10. Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. In answering the questions, use nonpreemptive scheduling and base all decisions on the information you have at the time the decision must be made.
        Process    Arrival Time    CPU Time
           P1           0.0           8
           P2           0.4           4
           P3           1.0           1
  11. What advantage is there in having different time-quantum sizes on different levels of a multilevel queueing system?
  12. Consider the scheduling algorithms we talked about (and those in the text we didn't talk about in class) on how they treat short processes.
  13. Describe the appropriateness of spin locks for uniprocessor and multiprocessor systems.
  14. The Cigarette-Smokers Problem. Consider a system with three smoker processes and one agent process. Each smoker continuously rolls a cigarette and then smokes it. But to roll and smoke a cigarette, the smoker needs three ingredients: tobacco, paper, and matches. One of the smoker processes has paper, another has tobacco, and the third has matches. The agent has an infinite supply of all three materials. The agent places two of the ingredients on the table. The smoker who has the remaining ingredient then makes and smokes a cigarette, signaling the agent on completion. The agent then puts another two of the three ingredients, and the cycle repeats. Write a program to synchronize the agent and the smokers.
  15. A file is to be shared among different processes, each of which has a unique number. The file can be accessed simultaneously by several processes, subject to the following constraint: The sum of all unique numbers associated with all the processes currently accessing the file must be less than n. Write a monitor to coordinate access to the file.
  16. Give an example that a system in an unsafe state can complete the execution of all processes without entering a deadlock state.
  17. In almost all computers with translation lookaside buffers, the TLB must be flushed (all the entries must be invalidated) during each process context switch. Why? What changes/features are needed in the TLB such that TLB flushes are unnecessary at process context switches?
  18. Explain why it is easier to share a library module using segmentation than it is when pure paging is used.
  19. With a given hardware architecture, can the OS choose from different page table schemes? Or if the answer depends on the type of hardware architecture, describe what type of hardware allows such flexibility in the OS and what type does not?