Midterm Prep
Midterm Prep
Multiple Choice
3. A ____ can be used to prevent a user program from never returning control to the
operating system.
A) portal
B) program counter
C) firewall
D) timer
8. The ____ of a process contains temporary data such as function parameters, return
addresses, and local variables.
A) text section
B) data section
C) program counter
D) stack
10. When a child process is created, which of the following is a possibility in terms of the
execution or address space of the child process?
A) The child process runs concurrently with the parent.
B) The child process has a new program loaded into it.
C) The child is a duplicate of the parent.
D) All of the above
11. A _________________ saves the state of the currently running process and restores
the state of the next process to run.
A) save-and-restore
B) state switch
C) context switch
D) none of the above
16. 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]
18. What is the correct order of operations for protecting a critical section using mutex
locks?
A) release() followed by acquire()
B) acquire() followed by release()
C) wait() followed by signal()
D) signal() followed by wait()
19. What is the correct order of operations for protecting a critical section using a binary
semaphore?
A) release() followed by acquire()
B) acquire() followed by release()
C) wait() followed by signal()
D) signal() followed by wait()
21. Assume an adaptive mutex is used for accessing shared data on a Solaris system with
multiprocessing capabilities. Which of the following statements is not true?
A) A waiting thread may spin while waiting for the lock to become available.
B) A waiting thread may sleep while waiting for the lock to become available.
C) The adaptive mutex is only used to protect short segments of code.
D) Condition variables and semaphores are never used in place of an adaptive mutex.
22. What is the purpose of the mutex semaphore in the implementation of the bounded-
buffer problem using semaphores?
A) It indicates the number of empty slots in the buffer.
B) It indicates the number of occupied slots in the buffer.
C) It controls access to the shared buffer.
D) It ensures mutual exclusion.
23. How many philosophers may eat simultaneously in the Dining Philosophers problem
with 5 philosophers?
A) 1
B) 2
C) 3
D) 5
25. _____ is/are not a technique for managing critical sections in operating systems.
A) Peterson's solution
B) Preemptive kernel
C) Nonpreemptive kernel
D) Semaphores
26. When using semaphores, a process invokes the wait() operation before accessing
its critical section, followed by the signal() operation upon completion of its
critical section. Consider reversing the order of these two operations—first calling
signal(), then calling wait(). What would be a possible outcome of this?
A) Starvation is possible.
B) Several processes could be active in their critical sections at the same time.
C) Mutual exclusion is still assured.
D) Deadlock is possible.
True/False
27. The operating system kernel consists of all system and application programs in a
computer.
29. A dual-core system requires each core has its own cache memory.
31. For a single-processor system, there will never be more than one process in the
Running state.
33. A thread is composed of a thread ID, program counter, register set, and heap.
35. Each thread has its own register set and stack.
36. The value of a counting semaphore can range only between 0 and 1.
37. A deadlock-free solution eliminates the possibility of starvation.
38. The local variables of a monitor can be accessed by only the local procedures.
39. Monitors are a theoretical concept and are not practised in modern programming
languages
40. A thread will immediately acquire a dispatcher lock that is the signalled state.
41. Mutex locks and counting semaphores are essentially the same things.
42. Mutex locks and binary semaphores are essentially the same things.
Long Answer
44. Describe the differences between physical, virtual, and logical memory.
46. Describe why direct memory access (DMA) is considered an efficient mechanism for
performing I/O.
47. Describe why multi-core processing is more efficient than placing each processor on
its own chip.
48. Name and describe the different states that a process can exist in at any given time.
49. Explain the main differences between a short-term and long-term scheduler.
50. Explain the difference between an I/O-bound process and a CPU-bound process.
52. List the four major categories of the benefits of multithreaded programming. Briefly
explain each.
54. What three conditions must be satisfied in order to solve the critical section problem?
55. Describe the dining-philosophers problem and how it relates to operating systems.