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.
- Under what circumstance would a user be better off using a time-sharing
system, rather than a single-user PC?
- The OS is a resource manager. Is it really necessary to efficiently use
computing resources for a single-user PC with a 2GHz processor?
- What are the differences between hardware interrupts, software traps, and
- 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.
- What is the main advantage of layered operating system design?
- What is the main advantage of the microkernel operating system design?
- Describe the performance cost for thread and process context switching.
- What resources are required to create a process?
- What resources are required to create a thread? Why or how is this
different than process creation?
- 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
- What is the average turnaround time for these processes with the
FCFS scheduling algorithm?
- What is the average turnaround time for these processes with the SJF
- The SJF algorithm is supposed to improve performance, but notice that
we chose to run process P1 at time 0 because we did not know that two
shorter processes would arrive soon. Compute what the average turnaround
time will be if the CPU is left idle for the first 1 unit and then SJF
scheduling is used.
- What advantage is there in having different time-quantum sizes on different
levels of a multilevel queueing system?
- 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.
- Describe the appropriateness of spin locks for uniprocessor and multiprocessor
- 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.
- 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.
- Give an example that a system in an unsafe state can complete the execution of
all processes without entering a deadlock state.
- 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?
- Explain why it is easier to share a library module using segmentation than it
is when pure paging is used.
- 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?