Parallel F2 mod 3
Quiz yourself by thinking what should be in
each of the black spaces below before clicking
on it to display the answer.
Help!
|
|
||||
---|---|---|---|---|---|
show | There is no limit on the number of threads that can possess a Lock at the same time.
🗑
|
||||
show | Protecting a critical section of code with mutual exclusion means only allowing authorized threads to execute the critical section.
🗑
|
||||
False | show 🗑
|
||||
show | Using the ++ operator to increment a variable in Java executes as multiple instructions at the lowest level.
🗑
|
||||
show | Using the ++ operator to increment a variable in Java executes as a single instruction at the lowest level.
🗑
|
||||
show | Data races can be hard to identify because the problems that data races cause have an insignificant impact on the program's performance.
🗑
|
||||
show | Data races can be hard to identify because the data race may not always occur during execution to cause a problem.
🗑
|
||||
show | Two threads that are both reading and writing the same shared variable has no potential for a data race.
🗑
|
||||
show | How many threads can possess a Lock at the same time?
🗑
|
||||
True | show 🗑
|
||||
show | When the threads in the program are not making progress, you can determine if it is due to a deadlock or a livelock by randomly guessing between deadlock and livelock.
🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
True | show 🗑
|
||||
show | Unlike during a deadlock, the threads in a livelock scenario are still making progress towards their goal.
🗑
|
||||
tryLock() is a non-blocking version of the lock() method | show 🗑
|
||||
show | Which statement describes the relationship between Lock and ReentrantLock in Java?
🗑
|
||||
True | show 🗑
|
||||
False | show 🗑
|
||||
show | Two threads that are both reading the same shared variable has no potential for a data race.
🗑
|
||||
show | The best use case for using a ReadWriteLock is when lots of threads need to modify the value of a shared variable.
🗑
|
||||
Prevent multiple threads from concurrently executing in the critical section | show 🗑
|
||||
The large number of write operations on the shared variable provided more opportunities for the data race to occur | show 🗑
|
||||
show | How many threads can possess the ReadLock while another thread has a lock on the WriteLock?
🗑
|
||||
show | Two threads that are both reading and writing the same shared variable has the potential for a data race.
🗑
|
||||
True | show 🗑
|
||||
show | Lock and ReentrantLock are two names for the same class.
🗑
|
||||
show | A ReentrantLock instantiates a new internal Lock object every time its lock() method is called.
🗑
|
||||
multiple times by the same thread | show 🗑
|
||||
True | show 🗑
|
||||
show | A maximum of 2 threads can possess a Lock at the same time.
🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
show | A ReentrantLock can be locked by the same thread as many times depending on the operating system.
🗑
|
||||
show | When the threads in the program are not making progress, you can determine if it is due to a deadlock or a livelock waiting to see if the problem eventually resolves itself.
🗑
|
||||
True | show 🗑
|
||||
True | show 🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
show | Which of these scenario describes the best use case for using a ReadWriteLock?
🗑
|
||||
show | When a thread calls Java's tryLock() method on a Lock that is NOT currently locked by another thread the method immediately returns false.
🗑
|
||||
True | show 🗑
|
||||
show | A thread does not need to unlock a ReentrantLock before another thread can acquire it because multiple threads can lock a ReentrantLock at the same time.
🗑
|
||||
show | Unlike during a deadlock, the threads in a livelock scenario are _____.
🗑
|
||||
True | show 🗑
|
||||
False | show 🗑
|
||||
show | Two threads that are both writing to the same shared variable has no potential for a data race.
🗑
|
||||
True | show 🗑
|
||||
show | A maximum of 2 threads can possess the WriteLock of a ReentrantReadWriteLock at the same time.
🗑
|
||||
True | show 🗑
|
||||
show | When a thread calls Java's tryLock() method on a Lock that is NOT currently locked by another thread the method will block until the Lock is available and then return false.
🗑
|
||||
show | The tryLock() method is useful because if multiple threads try to acquire a lock simultaneously, the tryLock() method will randomly pick one to succeed.
🗑
|
||||
True | show 🗑
|
||||
False | show 🗑
|
||||
show | A thread must unlock a ReentrantLock once before another thread can acquire it.
🗑
|
||||
show | A possible strategy to resolve a livelock between multiple threads is thru randomly terminating one of the threads involved in the livelock.
🗑
|
||||
Implement a randomized mechanism to determine which thread goes first | show 🗑
|
||||
show | Using the ++ operator to increment a variable in Java executes as an atomic instruction at the lowest level.
🗑
|
||||
False | show 🗑
|
||||
no limit | show 🗑
|
||||
True | show 🗑
|
||||
False | show 🗑
|
||||
show | Locker Mutex protects critical section of the code to defend against data races, which can occur when multiple threads are concurrently accessing the same location in memory and at least one of those threads is writing to that location.
🗑
|
||||
True | show 🗑
|
||||
show | Having too many concurrent threads may still not lead to starvation.
🗑
|
||||
show | No thread can possess the ReadLock while another thread has a lock on the WriteLock.
🗑
|
||||
show | The reader-writer lock is useful especially when there are lots of threads that only need to be read.
🗑
|
||||
show | The tryLock() method is useful because it enforces fairness among multiple threads competing for ownership of the same lock.
🗑
|
||||
True | show 🗑
|
||||
Use the Resource Monitor to investigate the program's CPU usage to see if it is actively executing | show 🗑
|
||||
show | To avoid livelock, ensure that only one process takes action chosen by priority or some other mechanism, like random selection.
🗑
|
||||
show | Using the ++ operator to increment a variable in Java executes as _____ at the lowest level.
🗑
|
||||
True | show 🗑
|
||||
show | How many times must a thread unlock a ReentrantLock before another thread can acquire it?
🗑
|
||||
show | The best use case for using a ReadWriteLock is when lots of threads need to read the value of a shared variable, but only a few thread need to modify its value.
🗑
|
||||
show | Read-write locks can improve a program's performance compared to using a standard mutex.
🗑
|
||||
False | show 🗑
|
||||
show | Data race occurs when a thread is unable to gain access to a necessary resource, and is therefore unable to make progress.
🗑
|
||||
False | show 🗑
|
||||
show | Unlike during a deadlock, the threads in a livelock scenario are stuck in a blocked state waiting on other threads.
🗑
|
||||
1 | show 🗑
|
||||
show | trylock() includes built-in error handling so you do not need a separate try/catch statement.
🗑
|
||||
show | Why is the trylock() method useful?
🗑
|
||||
Two threads are both reading the same shared variable | show 🗑
|
||||
True | show 🗑
|
||||
show | The semaphore's release() method decrements its value if the counter is positive.
🗑
|
||||
True | show 🗑
|
||||
True | show 🗑
|
||||
show | The binary semaphore can be acquired and released by different threads.
🗑
|
||||
False | show 🗑
|
||||
show | Pipeline architecture consists of a chained-together series of producer-consumer pairs.
🗑
|
||||
show | Which of these is a possible strategy to prevent deadlocks when multiple threads will need to acquire multiple locks?
🗑
|
||||
The binary semaphore can be acquired and released by different threads | show 🗑
|
||||
show | When should a thread typically signal a condition variable?
🗑
|
||||
show | Condition variables work together with a thread serving as a monitor.
🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
show | The Callable interface's call() method returns a result object but the Runnable interface's run() method does not.
🗑
|
||||
False | show 🗑
|
||||
show | A future serves as the counterpart to a programming past.
🗑
|
||||
the OS execution scheduler | show 🗑
|
||||
show | A race condition is a flaw in the timing or ordering of a program's execution that causes incorrect behavior.
🗑
|
||||
show | Heisenbug is a software bug that seems to disappear or alter its behavior when you try to study it.
🗑
|
||||
show | A deadlock avoidance algorithm dynamically examines the _____ to ensure that a circular wait condition can never exist.
🗑
|
||||
False | show 🗑
|
||||
show | Tracking the availability of a limited resource is a common use case for a counting semaphore.
🗑
|
||||
False | show 🗑
|
||||
show | Calling the semaphore's release() method signals another thread waiting to acquire the semaphore.
🗑
|
||||
False | show 🗑
|
||||
show | The binary semaphore will have a value of 0, 1, 2, 3, etc.
🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
show | A Semaphore is different from a Mutex in such a way that both can be released by different threads.
🗑
|
||||
True | show 🗑
|
||||
show | A deadlock avoidance algorithm dynamically examines the system storage state to ensure that a circular wait condition can never exist.
🗑
|
||||
False | show 🗑
|
||||
True | show 🗑
|
||||
Stop subdividing the current problem and solve it | show 🗑
|
||||
show | What is the difference between Java's Callable and Runnable interfaces?
🗑
|
||||
show | When several processes access the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called?
🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
show | The binary semaphore can only be acquired and released by the same thread.
🗑
|
||||
show | The average rates of production and consumption has not relation in a producer-consumer architecture?
🗑
|
||||
Signal another thread waiting to acquire the semaphore | show 🗑
|
||||
False | show 🗑
|
||||
show | A future is a task that can be assigned to a thread pool for execution.
🗑
|
||||
False | show 🗑
|
||||
True | show 🗑
|
||||
show | Socket is a synchronization tool?
🗑
|
||||
True | show 🗑
|
||||
show | Which one of the following is a synchronization tool?
🗑
|
||||
True | show 🗑
|
||||
show | The semaphore's acquire() method increments its value if the counter is positive.
🗑
|
||||
The queue will fill up and cause an error | show 🗑
|
||||
show | Which architecture consists of a chained-together series of producer-consumer pairs?
🗑
|
||||
holding place; wait for a certain condition before continuing execution | show 🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
True | show 🗑
|
||||
show | Data races can occur when two or more threads concurrently access the same memory location.
🗑
|
||||
show | The semaphore's acquire() method always decrements the counter's value.
🗑
|
||||
show | FIFO architecture consists of a chained-together series of producer-consumer pairs.
🗑
|
||||
You only need to wake up one waiting thread and it does not matter which one | show 🗑
|
||||
True | show 🗑
|
||||
show | Condition variables work together with a process serving as a monitor.
🗑
|
||||
show | When implementing a recursive divide-and-conquer algorithm in Java, the ForKJoinPool manages a thread pool to execute its ForKJoinTasks, which reduces the overhead of thread creation.
🗑
|
||||
show | When it reaches the base case, a divide-and-conquer algorithm divides the problem into two smaller subproblems.
🗑
|
||||
show | A Runnable object cannot be used to create a Future.
🗑
|
||||
False | show 🗑
|
||||
show | What is the purpose of a future?
🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
False | show 🗑
|
||||
show | When implementing a recursive divide-and-conquer algorithm in Java, why should you use a ForkJoinPool instead of simply creating new threads to handle each subproblem?
🗑
|
||||
False | show 🗑
|
||||
show | If the producer puts elements into a fixed-length queue faster than the consumer removes them, the queue will fill up and cause an error.
🗑
|
||||
show | The producer-consumer pattern follows FIFO method.
🗑
|
||||
show | Client-server architecture consists of a chained-together series of producer-consumer pairs.
🗑
|
||||
show | What does the semaphore's release() method do to the counter value?
🗑
|
||||
show | Condition variables enable threads to signal each other when the state of the queue changes.
🗑
|
||||
True | show 🗑
|
||||
False | show 🗑
|
||||
show | There is no limit on the number of threads that can possess the ReadLock while another thread has a lock on the WriteLock.
🗑
|
||||
show | Protecting a critical section of code with mutual exclusion means preventing multiple threads from concurrently executing in the critical section.
🗑
|
||||
show | What is the maximum number of threads that can possess the WriteLock of a ReadWriteLock at the same time?
🗑
|
||||
show | Try lock or try enter is a blocking version of the lock or acquire method.
🗑
|
||||
show | Data races can be hard to identify because data races are caused by hardware errors and cannot be debugged in software.
🗑
|
||||
show | Why can potential data races be hard to identify?
🗑
|
||||
show | There is no limit on the number of threads that can possess the WriteLock of a ReadWriteLock at the same time.
🗑
|
Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.
Normal Size Small Size show me how
Normal Size Small Size show me how
Created by:
user-1902021