CSC 415 Operating System Principles Unit 05

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following variables are shared between the processes in Peterson's solution? Select one: a. boolean flag[2] b. none of the other answers c. int turn d. both of the above

d. both of the above

Solutions to the critical section problem may suffer from liveness failures. Select one: a. False b. True

b. True

A solution to the critical section problem does not have to satisfy which of the following requirements? Select one: a. progress b. atomicity c. mutual exclusion d. bounded waiting

b. atomicity

Under which of the following contention loads does traditional synchronization become faster than CAS-based synchronization? Select one: a. none of the other answers b. high contention c. uncontended d. moderate contention

b. high contention

One necessary condition for deadlock is ____, which states that a process must be holding one resource and waiting to acquire additional resources. Select one: a. no preemption b. hold and wait c. circular wait d. mutual exclusion

b. hold and wait

Another problem related to deadlocks is ____________. Select one: a. critical sections b. indefinite blocking c. race conditions d. spinlocks

b. indefinite blocking

Pthreads can be implemented Select one: a. at the user level or inside the operating system kernel b. only at the user level c. only inside the operating system kernel d. only Windows OS

a. at the user level or inside the operating system kernel

A counting semaphore ____. Select one: a. is essentially an integer variable b. cannot be used to control access to a thread's critical sections c. is accessed through only one standard operation d. can be modified simultaneously by multiple threads

a. is essentially an integer variable

A ___ type presents a set of programmer-defined operations that are provided mutual exclusion within it. Select one: a. monitor b. binary c. transaction d. signal

a. monitor

A deadlock-free solution eliminates the possibility of starvation. Select one: True False

False

If a resource-allocation graph has a cycle, the system must be in a deadlocked state. Select one: True False

False

In the dining philosophers problem, there is a possibility of deadlock but not livelock. Select one: True False

False

Linux mostly uses atomic integers to manage race conditions within the kernel. Select one: True False

False

Monitors are a theoretical concept and are not practiced in modern programming languages Select one: True False

False

Traditional synchronization is always much faster than CAS-based synchronization. Select one: True False

False

When the owner of a mutex lock invokes pthread mutex unlock(), all threads blocked on that mutex's lock are unblocked. Select one: True False

False

A nonpreemptive kernel is safe from race conditions on kernel data structures. Select one: True False

True

A thread will immediately acquire a dispatcher lock that is the signaled state. Select one: True False

True

Both the test_ and_set() instruction and compare_and_swap() instruction are executed atomically. Select one: True False

True

Busy waiting refers to the phenomenon that while a process is in its critical section, any other process that tries to enter its critical section must loop continuously in the call to acquire the mutex lock. Select one: True False

True

Deadlock occurs when every thread in a set is blocked waiting for an event that can be caused only by another thread in the set, while livelock occurs when a thread continuously attempts an action that fails. Select one: True False

True

Instructions from different processes can be interleaved when interrupts are allowed. Select one: True False

True

Mutex locks and binary semaphores are essentially the same thing. Select one: True False

True

Race conditions are prevented by requiring that critical regions be protected by locks. Select one: True False

True

The local variables of a monitor can be accessed by only the local procedures. Select one: True False

True

What is the correct order of operations for protecting a critical section using mutex locks? Select one: a. acquire() followed by release() b. wait() followed by signal() c. signal() followed by wait() d. release() followed by acquire()

a. acquire() followed by release()

Which of the following is NOT true for Peterson's solution? Select one: a. Peterson's solution works for synchronization among more than two processes b. The progress requirement is satisfied c. The bounded-waiting requirement is met d. Mutual exclusion is preserved

a. Peterson's solution works for synchronization among more than two processes

Every object in Java has associated with it a single lock. Select one: a. True b. False

a. True

Semaphore implementation overcomes the busy waiting problem. Select one: a. True b. False

a. True

A call to pthread_cond_signal() Select one: a. signals one thread waiting on the condition variable, but does not release the mutex lock. b. signals all threads waiting on the condition variable, but does not release the mutex lock. c. releases the mutex lock and signals all threads waiting on the condition variable. d. releases the mutex lock and signals one thread waiting on the condition variable.

a. signals one thread waiting on the condition variable, but does not release the mutex lock.

A monitor is an abstract data type that is based on semaphore implementation. Select one: a. True b. False

b. False

CAS-based synchronization is always faster than traditional synchronization. Select one: a. True b. False

b. False

Peterson's solution works on modern computer architectures. Select one: a. True b. False

b. False

Which of the following is a software-based solution to the critical-section problem? Select one: a. test_and_set b. Peterson's solution c. all of the other answers d. compare_and_swap

b. Peterson's solution

____________ occurs when a higher-priority process needs to access a data structure that is currently being accessed by a lower-priority process. Select one: a. Deadlock b. Priority inversion c. A critical section d. A race condition

b. Priority inversion

Which of the following may cause a liveness failure? Select one: a. a busy waiting loop b. all of the other answers c. an infinite loop d. a deadlock

b. all of the other answers

A(n) _______ refers to where a process is accessing/updating shared data. Select one: a. mutex b. critical section c. entry section d. test-and-set

b. critical section

An instruction that executes atomically ____. Select one: a. cannot be used to solve the critical section problem b. executes as a single, uninterruptible unit c. must consist of only one machine instruction d. All of the other answers

b. executes as a single, uninterruptible unit

Which of the following critical-section problem's requirements ensures programs will cooperatively determine what process will next enter its critical section? Select one: a. none of the other answers b. progress c. bounded waiting d. mutual exclusion

b. progress

The first readers-writers problem ____. Select one: a. requires that no reader will be kept waiting unless a reader has already obtained permission to use the shared database. b. requires that no reader will be kept waiting unless a writer has already obtained permission to use the shared database. c. is not used to test synchronization primitives. d. requires that, once a writer is ready, that writer performs its write as soon as possible.

b. requires that no reader will be kept waiting unless a writer has already obtained permission to use the shared database.

How many philosophers may eat simultaneously in the Dining Philosophers problem with 5 philosophers? Select one: a. 5 b. 4 c. 2 d. 1 e. 3

c. 2

A cycle in a resource-allocation graph is ____. Select one: a. a necessary and sufficient condition for deadlock in the case that each resource has more than one instance b. a sufficient condition for a deadlock in the case that each resource has more than once instance c. a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance d. is neither necessary nor sufficient for indicating deadlock in the case that each resource has exactly one instance

c. a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance

Which of the following are efforts to towards developing scalable, efficient tools that address the demands of concurrent programming? Select one: a. developing languages that provide support for concurrent programming b. designing compilers that generate more efficient code c. all of the other answers d. improving the performance of existing libraries and APIs

c. all of the other answers

Which of the following is true regarding the requirements for the solutions to critical-section problem? Select one: a. none of the other answers b. progress implies bounded waiting c. bounded waiting implies progress d. mutual exclusion implies progress

c. bounded waiting implies progress

When mutex lock is implemented as a binary semaphore, what should its value be initialized to be? Select one: a. none of the other answers b. 0 c. -1 d. 1

d. 1

What is the purpose of the mutex semaphore in the implementation of the bounded-buffer problem using semaphores? Select one: 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.

d. It ensures mutual exclusion.

Which of the following statements is true? Select one: a. Operations on atomic integers do require additional locking. b. Linux only provides the atomic_inc() and atomic_sub() operations. c. Operations on atomic integers can be interrupted. d. Operations on atomic integers do not require locking.

d. Operations on atomic integers do not require locking.

_____ can be used to prevent busy waiting when implementing a semaphore. Select one: a. Mutex lock b. Allowing the wait() operation to succeed c. Spinlocks d. Waiting queues

d. Waiting queues

A deadlocked state occurs whenever ____. a process is waiting for I/O to a device that does not exist Select one: a. a process is waiting for I/O to a device that does not exist b. a process is unable to release its request for a resource after use c. the system has no available free resources d. every process in a set is waiting for an event that can only be caused by another process in the set

d. every process in a set is waiting for an event that can only be caused by another process in the set

A mutex lock ____. Select one: a. is not guaranteed to be atomic b. can be used to eliminate busy waiting c. is exactly like a counting semaphore d. is essentially a boolean variable

d. is essentially a boolean variable

A race condition ______. Select one: a. will result only if the outcome of execution does not depend on the order in which instructions are executed b. None of the other answers c. results when several threads try to access the same data concurrently d. results when several threads try to access and modify the same data concurrently

d. results when several threads try to access and modify the same data concurrently


Kaugnay na mga set ng pag-aaral

Graded Potentials, AP, and Synaptic Transmission

View Set

Med Serg: Ch 14-Neurologic Disorder study guide

View Set

Drive Home Safe Driving School - Chapter 12 (Review For Final)

View Set

Chapter 4: Consolidated Financial Statements and Outside Ownership

View Set

CG2d Describe ho state government is funded and how spending decisions are made.

View Set

Mental health study questions: Townsend

View Set