Parallel Programming Questions Flashcards
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()
C) wait() followed by signal()
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
B) results when several threads try to access and modify the same data concurrently
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
B) executes as a single, uninterruptible unit
A counting 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
A) is essentially an integer variable
A mutex lock \_\_\_\_ A) is exactly like a counting semaphore B) is essentially a boolean variable C) is not guaranteed to be atomic D) can be used to eliminate busy waiting
B) is essentially a boolean variable
In Peterson's solution, the \_\_\_\_ variable indicates if a process i is ready to enter its critical section. A) turn B) lock C) flag[i] D) turn[i]
C) flag[i]
A \_\_\_ type presents a set of programmer-defined operations that are provided mutual exclusion within it. A) transaction B) signal C) binary D) monitor
D) monitor
\_\_\_\_\_\_\_\_\_\_\_\_ occurs when a higher-priority process needs to access a data structure that is currently being accessed by a lower-priority process. A) Priority inversion B) Deadlock C) A race condition D) A critical section
A) Priority inversion
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()
B) acquire() followed by release()
Does brainscape sometimes say it saved your cards, only for you to return later and find out they weren’t actually saved?
Yes. Fuck brainscape.
\_\_\_\_\_ is not a technique for handling critical sections in operating systems. A) Non-preemptive kernels B) Preemptive kernels C) Spinlocks D) Peterson's solution
D) Peterson’s solution
A solution to the critical section problem does not have to satisfy which of the following requirements? A) mutual exclusion B) progress C) atomicity D) bounded waiting
C) atomicity
A(n) \_\_\_\_\_\_\_ refers to where a process is accessing/updating shared data. A) critical section B) entry section C) mutex D) test-and-set
A) critical section
_____ can be used to prevent busy waiting when implementing a semaphore.
A) Spinlocks
B) Waiting queues
C) Mutex lock
D) Allowing the wait() operation to succeed
B) Waiting queues
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.
D) It ensures mutual exclusion.
How many philosophers may eat simultaneously in the Dining Philosophers problem with 5 philosophers? A) 1 B) 2 C) 3 D) 5
B) 2
\_\_\_\_\_ is/are not a technique for managing critical sections in operating systems. A) Peterson's solution B) Preemptive kernel C) Non-preemptive kernel D) Semaphores
A) Peterson’s solution
When using semaphores, 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.
B) Several processes could be active in their critical sections at the same time.
Which of the following statements is true?
A) Operations on atomic integers do not require locking.
B) Operations on atomic integers do require additional locking.
C) Linux only provides the atomic_inc() and atomic_sub() operations.
D) Operations on atomic integers can be interrupted.
A) Operations on atomic integers do not require locking.
The OpenMP #pragma omp critical directive ___________.
A) behaves much like a mutex lock
B) does not require programmers to identify critical sections
C) does not guarantee prevention of race conditions
D) is similar to functional languages
A) behaves much like a mutex lock
Another problem related to deadlocks is \_\_\_\_\_\_\_\_\_\_\_\_. A) race conditions B) critical sections C) spinlocks D) indefinite blocking
D) indefinite blocking
According to Amdahl's Law, what is the speedup gain for an application that is 60% parallel when we run it on a machine with four processing cores? A) 1.82 B) .7 C) .55 D) 1.43
A) 1.82
\_\_\_\_\_\_\_\_\_ involves distributing tasks across multiple computing cores. A) Concurrency B) Task parallelism C) Data parallelism D) Parallelism
B) Task parallelism
\_\_\_\_\_\_\_\_\_\_\_ is a formula that identifies potential performance gains from adding additional computing cores to an application that has a parallel and serial component. A) Task parallelism B) Data parallelism C) Data splitting D) Amdahl's Law
D) Amdahl’s Law
When OpenMP encounters the #pragma omp parallel directive, it ____.
A) constructs a parallel region
B) creates a new thread
C) creates as many threads as there are processing cores
D) parallelizes for loops
C) creates as many threads as there are processing cores
______________ leads to concurrency.
a) Serialization
b) Parallelism
c) Serial processing
d) Distribution
b) Parallelism
A parallelism based on increasing processor word size.
a) Increasing
b) Count based
c) Bit based
d) Bit level
d) Bit level
A type of parallelism that uses micro architectural techniques.
a) instructional
b) bit level
c) bit based
d) increasing
a) instructional