MIDTERM Examination #2

operating system concepts

03-60-330-01

University of Windsor

School of Computer Science

Winter 2008

Last Name:
First Name: /
Student ID: /
Please read carefully before you start
1.  This is a CLOSED book test; no notes, textbooks, calculators or computer aids are allowed.
2.  PRINT your name legibly and clearly with your Student ID in the space indicated above.
3.  You will be asked to sign your name before leaving the exam room (sign-out).
4.  All questions are multiple choice or true/false. Circle the single response which best answers each question.
5.  DO NOT REMOVE any pages or attach any papers to this test or you will void your test and receive a mark of zero.
6.  You are not allowed to give or receive unauthorized help with your test. Any misconduct, as outlined by the Senate bylaw 31 article I, will be reported accordingly.
7.  You have 60 minutes to complete this test.
8.  Midterm examination papers will be returned to students.
Good Luck!
I agree to the above terms and will neither receive nor give unauthorized help on this exam

Signature
/ /
Date


All questions are Multiple Choice or True/False. In each Multiple Choice question, 4 responses are provided – you are to choose only one response which best answers the question. Circle the letter A, B, C or D (one only).

If an error is made you must carefully indicate this and then fill in the circle you intend to choose (a brief note is adequate).

1. / Absolute code can be generated for ____.
A) / compile time binding
B) / load time binding
C) / execution time binding
D) / interrupt binding
2. / Which of the following methods of binding instructions and data to memory is performed by most general-purpose operating systems?
A) / interrupt binding
B) / compile time binding
C) / execution time binding
D) / load time binding
3. / An address generated by a CPU is referred to as a ____.
A) / physical address
B) / logical address
C) / post relocation register address
D) / Memory-Management Unit (MMU) generated address
4. / Suppose we are operating with execution-time binding and the physical address generated is 300. The relocation register is set to 100. What is the corresponding logical address?
A) / 199
B) / 201
C) / 200
D) / 300
5. / In a dynamically linked library, ____.
A) / loading is postponed until execution time
B) / system language libraries are treated like any other object module
C) / more disk space is used than the option of using a statically-linked library
D) / a stub is included in the image for each library-routine reference
6. / Which of the following binding schemes facilitates swapping?
A) / interrupt time
B) / load time
C) / assembly time
D) / execution time
7. / The roll out, roll in variant of swapping is used ____.
A) / when a backing store is not necessary
B) / for the round-robin scheduling algorithm
C) / for priority-based scheduling algorithms
D) / when the load on the system has temporarily been reduced
8. / Which of the following dynamic storage-allocation algorithms results in the smallest leftover hole in memory?
A) / first fit
B) / best fit
C) / worst fit
D) / None of the above
9. / Which of the following is true of compaction?
A) / It can be done at assembly, load, or execution time.
B) / It is used to solve the problem of internal fragmentation.
C) / It cannot shuffle memory contents.
D) / It is possible only if relocation is dynamic and done at execution time.
10. / A deadlocked state occurs whenever ____.
A) / a process is waiting for I/O to a device that does not exist
B) / the system has no available free resources
C) / every process in a set is waiting for an event that can only be caused by another process in the set
D) / a process is unable to release its request for a resource after use
11. / One necessary condition for deadlock is ____, which states that at least one resource must be held in a nonsharable mode.
A) / hold and wait
B) / mutual exclusion
C) / circular wait
D) / no preemption
12. / In a system resource-allocation graph, ____.
A) / a directed edge from a process to a resource is called an assignment edge
B) / a directed edge from a resource to a process is called a request edge
C) / a directed edge from a process to resource is called a request edge
D) / None of the above
13. / A cycle in a resource-allocation graph is ____.
A) / a necessary and sufficient condition for deadlock in the case that each resource has more than one instance
B) / a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance
C) / a sufficient condition for a deadlock in the case that each resource has more than once instance
D) / is neither necessary nor sufficient for indicating deadlock in the case that each resource has exactly one instance
14. / Which of the following is most often used by operating systems to handle deadlocks?
A) / Pretend that deadlocks never occur
B) / Use protocols to prevent or avoid deadlocks
C) / Detect and recover from deadlocks
D) / None of the above
15. / Which of the following statements is true?
A) / A safe state is a deadlocked state.
B) / A safe state may lead to a deadlocked state.
C) / An unsafe state is necessarily, and by definition, always a deadlocked state.
D) / An unsafe state may lead to a deadlocked state.
16. / Suppose that there are 10 resources available to three processes. At time 0, the following data is collected. The table indicates the process, the maximum number of resources needed by the process, and the number of resources currently owned by each process. Which of the following correctly characterizes this state?
Process Maximum Needs Currently Owned
P0 10 4
P1 3 1
P2 6 4
A) / It is safe.
B) / It is not safe.
C) / The state cannot be determined.
D) / It is an impossible state.
17. / Which of the following data structures in the Banker's algorithm is a vector of length m, where m is the number of resource types?
A) / Need
B) / Allocation
C) / Max
D) / Available
18. / The safety algorithm provided in the text may require what order of operations to determine whether a state is safe? Assume n is the number of processes and m is the number of resources.
A) /
B) /
C) /
D) /
19. / The circular-wait condition for a deadlock implies the hold-and-wait condition.
A) / True
B) / False
20. / If a resource-allocation graph has a cycle, the system must be in a deadlocked state.
A) / True
B) / False
21. / In some circumstances, a system can be in a frozen state but not in a deadlocked state.
A) / True
B) / False
22. / Race conditions are prevented by requiring that critical regions be protected by locks.
A) / True
B) / False
23. / In order to solve the critical section problem it is necessary to satisfy the condition that ______.
A) / No thread may be executing in its critical section if a thread is currently executing in its critical section.
B) / Only those threads that are not executing in their critical sections can participate in the decision on which process will enter its critical section next.
C) / A bound must exist on the number of times that other threads are allowed to enter their critical state after a thread has made a request to enter its critical state.
D) / All of the above.
24. / ______refers to the situation where, for a set of processes, every process in the set must be waiting for an event that can be caused only be another process in the set.
A) / Deadlock
B) / Starvation
C) / Locking
D) / Blocking
25. / The Banker's Algorithm is used ______
A) / to determine if a process state is safe
B) / to determine if resources can be allocated safely
C) / to determine if processes can be scheduled
D) / to determine if deadlock will occur
26. / The resource allocation graph below ______

A) / contains a cycle, but it is not deadlocked
B) / contains a cycle and it is deadlocked
C) / contains no cycles and is not deadlocked
D) / contains no cycles and is deadlocked
27. / The Banker's Algorithm is not used to ______.
A) / perform detection of deadlocks
B) / perform resource allocations
C) / perform detection of safe states
D) / Both A and C are correct responses.
28. / One way to ensure that a circular-wait condition never holds is to ______?
A) / apply a deadlock prevention policy.
B) / assign each resource type a unique integer number to distinguish those occurring at the same time in the ordering.
C) / impose a total ordering of all resource types and to require that each process requests resources in an increasing order of enumeration.
D) / None of these responses is correct.
29. / A race condition ____.
A) / results when several threads try to access the same data concurrently
B) / results when several threads try to access and modify the same data concurrently
C) / will result only if the outcome of execution does not depend on the order in which instructions are executed
D) / None of the above
30. / An instruction that executes atomically ____.
A) / must consist of only one machine instruction
B) / executes as a single, uninterruptible unit
C) / cannot be used to solve the critical section problem
D) / All of the above
31. / A semaphore ____.
A) / is essentially an integer variable
B) / is accessed through only one standard operation
C) / can be modified simultaneously by multiple threads
D) / cannot be used to control access to a thread's critical sections
32. / A spinlock ____.
A) / is never advantageous
B) / will ultimately result in a context switch when a process must wait on a lock
C) / does not require a context switch when a process must wait on a lock
D) / is useful when locks are expected to be held for long amounts of time
33. / In Peterson's solution, the ____ variable indicates if a process is ready to enter its critical section.
A) / turn
B) / lock
C) / flag[i]
D) / turn[i]
34. / A(n) ___ type presents a set of programmer-defined operations that are provided mutual exclusion within it.
A) / transaction
B) / signal
C) / binary
D) / monitor
35. / A transaction ____.
A) / performs multiple logical functions
B) / is a single instruction
C) / is a single operation
D) / performs a single logical function
36. / Suppose that there are 10 resources available to three processes. At time 0, the following data is collected. The table indicates the process, the maximum number of resources needed by the process, and the number of resources currently owned by each process. Which of the following correctly characterizes this state?
Process Maximum Needs Currently Owned
P0 10 4
P1 2 1
P2 6 4
A) / It is safe.
B) / It is not safe.
C) / The state cannot be determined.
D) / It is an impossible state.
37. / The wait-for graph scheme is not applicable to a resource allocation system with multiple instances of each resource type.
A) / True
B) / False
38. / A claim edge of a resource allocation graph ______.
A) / is identical to a request edge
B) / resembles an allocation edge in direction but is represented in the graph by a dashed line
C) / indicates that a process may request a resource at some time in the future
D) / requires that the claiming process be given high priority in scheduling
39. / The purpose of a Memory Management Unit is to ______.
A) / perform run-time mapping from virtual to physical addresses
B) / ensure protection of the memory space allocated to every process
C) / Both A and B are correct responses.
D) / None of these responses is correct.
40. / Suppose the following snapshot of the system resource allocation exists at time T. This describes 5 processes (P0 to P4) and 3 resource types, A, B and C.
Allocation / Max / Available
Process / A B C / A B C / A B C
P0 / 0 1 0 / 7 5 3 / 3 3 2
P1 / 3 0 2 / 9 0 2
P2 / 0 0 2 / 4 3 3
P3 / 2 0 0 / 3 2 2
P4 / 2 1 1 / 2 2 2
Both processes P2 and P3 request resources immediately. P2 requests 3 additional type A resources and 3 additional type B resources, while P3 requests 1 additional type A resources and 2 additional type C resources.
Which of the following statements is true about the safety of the resource requests by P2 and P3?
A) / Both P2 and P3 requests can be granted safely.
B) / Both P2 and P3 requests result in unsafe states.
C) / P2 can be granted safely, but P3 results in an unsafe state.
D) / P3 can be granted safely, but P2 results in an unsafe state.


Answer Key