Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

Parallel F2 mod 3

        Help!  

Question
Answer
False   There is no limit on the number of threads that can possess a Lock at the same time.  
🗑
False   Protecting a critical section of code with mutual exclusion means only allowing authorized threads to execute the critical section.  
🗑
False   Protecting a critical section of code with mutual exclusion means implementing proper error handling techniques to catch any unexpected problems.  
🗑
True   Using the ++ operator to increment a variable in Java executes as multiple instructions at the lowest level.  
🗑
False   Using the ++ operator to increment a variable in Java executes as a single instruction at the lowest level.  
🗑
False   Data races can be hard to identify because the problems that data races cause have an insignificant impact on the program's performance.  
🗑
True   Data races can be hard to identify because the data race may not always occur during execution to cause a problem.  
🗑
False   Two threads that are both reading and writing the same shared variable has no potential for a data race.  
🗑
1   How many threads can possess a Lock at the same time?  
🗑
True   The tryLock() method is useful because it enables a thread to execute alternate operations if the lock it needs to acquire is already taken.  
🗑
False   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   When the threads in the program are not making progress, you can determine if it is due to a deadlock or a livelock by using the Resource Monitor to investigate the program's memory usage to see if it continues to grow.  
🗑
False   When the threads in the program are not making progress, you can determine if it is due to a deadlock or a livelock by using the Resource Monitor to investigate the program's CPU usage to see if it is actively executing.  
🗑
True   Unlike during a deadlock, the threads in a livelock scenario are actively executing without making useful progress.  
🗑
False   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   What is the difference between the tryLock() and the regular lock() method in Java?  
🗑
ReentrantLock is a class that implements the Lock interface   Which statement describes the relationship between Lock and ReentrantLock in Java?  
🗑
True   In Java program, data race only occurs when each of the threads are incrementing a shared variable a large number of time because the large number of write operations on the shared variable provided more opportunities for the data race to occur.  
🗑
False   Data races can be hard to identify because it is impossible to identify the potential for a data race.  
🗑
True   Two threads that are both reading the same shared variable has no potential for a data race.  
🗑
False   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   What does it mean to protect a critical section of code with mutual exclusion?  
🗑
The large number of write operations on the shared variable provided more opportunities for the data race to occur   In the Java program to demonstrate a data race, why did the data race only occur when each of the threads were incrementing a shared variable a large number of time?  
🗑
0   How many threads can possess the ReadLock while another thread has a lock on the WriteLock?  
🗑
True   Two threads that are both reading and writing the same shared variable has the potential for a data race.  
🗑
True   When a thread calls Java's tryLock() method on a Lock that is NOT currently locked by another thread the method immediately returns true.  
🗑
False   Lock and ReentrantLock are two names for the same class.  
🗑
False   A ReentrantLock instantiates a new internal Lock object every time its lock() method is called.  
🗑
multiple times by the same thread   A ReentrantLock can be locked _____.  
🗑
True   Starvation occurs when a thread is unable to gain access to a necessary resource, and is therefore unable to make progress.  
🗑
False   A maximum of 2 threads can possess a Lock at the same time.  
🗑
False   The number of threads that can possess a Lock at the same time depends on the operating system.  
🗑
False   In Java program, data race only occurs when each of the threads are incrementing a shared variable a large number of time because the JVM's automatic data race prevention system can only protect against a small number of operations.  
🗑
False   There is no limit on the number of threads that can possess the ReadLock while another thread has a lock on the WriteLock.  
🗑
False   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 true.  
🗑
False   A ReentrantLock can be locked by the same thread as many times depending on the operating system.  
🗑
False   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   Dining Philosophers Problem is a classic example that's used to illustrate synchronization issues when multiple threads are competing for multiple locks.  
🗑
True   Having too many concurrent threads can lead to starvation.  
🗑
False   Protecting a critical section of code with mutual exclusion means that whenever a thread enters the critical section, it pauses all other threads in the program.  
🗑
False   The best use case for using a ReadWriteLock is when lots of threads need to modify the value of a shared variable, but only a few thread need to read its value.  
🗑
Lots of threads need to read the value of a shared variable, but only a few thread need to modify its value   Which of these scenario describes the best use case for using a ReadWriteLock?  
🗑
False   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   tryLock() is a non-blocking version of the lock() method.  
🗑
False   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.  
🗑
actively executing without making useful progress   Unlike during a deadlock, the threads in a livelock scenario are _____.  
🗑
True   Deadlock occurs when each member of a group is waiting for some other member to take action, and as a result, neither member is able to make progress.  
🗑
False   The processor decides when each thread gets scheduled to execute.  
🗑
False   Two threads that are both writing to the same shared variable has no potential for a data race.  
🗑
True   A maximum of 1 thread can possess the WriteLock of a ReentrantReadWriteLock at a time.  
🗑
False   A maximum of 2 threads can possess the WriteLock of a ReentrantReadWriteLock at the same time.  
🗑
True   To lock a mutex multiple times, using a reentrant mutex may seem like an easy way to avoid a deadlock.  
🗑
False   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.  
🗑
False   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   The lock() method can be called recursively on a ReentrantLock object, but not on a regular lock object.  
🗑
False   A thread must unlock a ReentrantLock as many times as that thread locked it before another thread can acquire it.  
🗑
True   A thread must unlock a ReentrantLock once before another thread can acquire it.  
🗑
False   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   Which of these is a possible strategy to resolve a livelock between multiple threads?  
🗑
False   Using the ++ operator to increment a variable in Java executes as an atomic instruction at the lowest level.  
🗑
False   A maximum of 2 threads can possess the ReadLock while another thread has a lock on the WriteLock?  
🗑
no limit   What is the maximum number of threads that can possess the ReadLock of a ReentrantReadWriteLock at the same time?  
🗑
True   Only 1 thread can possess a Lock at the same time.  
🗑
False   The maximum number of threads that can possess the WriteLock of a ReentrantReadWriteLock at the same time depends on the operating system.  
🗑
True   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   A possible strategy to resolve a livelock between multiple threads is thru implementing a randomized mechanism to determine which thread goes first.  
🗑
False   Having too many concurrent threads may still not lead to starvation.  
🗑
True   No thread can possess the ReadLock while another thread has a lock on the WriteLock.  
🗑
True   The reader-writer lock is useful especially when there are lots of threads that only need to be read.  
🗑
False   The tryLock() method is useful because it enforces fairness among multiple threads competing for ownership of the same lock.  
🗑
True   A ReentrantLock can be locked multiple times by the same thread.  
🗑
Use the Resource Monitor to investigate the program's CPU usage to see if it is actively executing   The threads in your program are clearly not making progress. How might you determine if it is due to a deadlock or a livelock?  
🗑
True   To avoid livelock, ensure that only one process takes action chosen by priority or some other mechanism, like random selection.  
🗑
multiple instructions   Using the ++ operator to increment a variable in Java executes as _____ at the lowest level.  
🗑
True   ReentrantLock is a class that implements the Lock interface.  
🗑
as many times as that thread locked it   How many times must a thread unlock a ReentrantLock before another thread can acquire it?  
🗑
True   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.  
🗑
True   Read-write locks can improve a program's performance compared to using a standard mutex.  
🗑
False   A possible strategy to resolve a livelock between multiple threads is thru patience because if you wait long enough all livelocks will eventually resolve themself.  
🗑
False   Data race occurs when a thread is unable to gain access to a necessary resource, and is therefore unable to make progress.  
🗑
False   A ReentrantLock can be locked once by multiple threads at the same time.  
🗑
False   Unlike during a deadlock, the threads in a livelock scenario are stuck in a blocked state waiting on other threads.  
🗑
1   What is the maximum number of threads that can possess the WriteLock of a ReentrantReadWriteLock at the same time?  
🗑
False   trylock() includes built-in error handling so you do not need a separate try/catch statement.  
🗑
It enables a thread to execute alternate operations if the lock it needs to acquire is already taken   Why is the trylock() method useful?  
🗑
Two threads are both reading the same shared variable   Which of these scenarios does NOT have the potential for a data race?  
🗑
True   Calling the semaphore's release() method blocks all other threads waiting on the semaphore.  
🗑
False   The semaphore's release() method decrements its value if the counter is positive.  
🗑
True   The semaphore's release() method always increments the counter's value.  
🗑
True   The semaphore's acquire() method decrements its value if the counter is positive.  
🗑
True   The binary semaphore can be acquired and released by different threads.  
🗑
False   If the producer puts elements into a fixed-length queue faster than the consumer removes them, the queue will continuously expand to hold the extra items.  
🗑
True   Pipeline architecture consists of a chained-together series of producer-consumer pairs.  
🗑
Prioritize the locks so that all threads will acquire them in the same relative order   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   What is the difference between a binary semaphore and a mutex?  
🗑
after doing something to change the state associated with the condition variable but before unlocking the associated mutex   When should a thread typically signal a condition variable?  
🗑
False   Condition variables work together with a thread serving as a monitor.  
🗑
False   When implementing a recursive divide-and-conquer algorithm in Java, the ForkJoinPool automatically subdivides the problem for you.  
🗑
False   When implementing a recursive divide-and-conquer algorithm in Java, threads cannot recursively spawn other threads.  
🗑
True   The Callable interface's call() method returns a result object but the Runnable interface's run() method does not.  
🗑
False   A future allows a program to change how it will function the next time it is run.  
🗑
False   A future serves as the counterpart to a programming past.  
🗑
the OS execution scheduler   Condition variables work together with which other mechanism serving as a monitor?  
🗑
True   A race condition is a flaw in the timing or ordering of a program's execution that causes incorrect behavior.  
🗑
True   Heisenbug is a software bug that seems to disappear or alter its behavior when you try to study it.  
🗑
resource allocation state   A deadlock avoidance algorithm dynamically examines the _____ to ensure that a circular wait condition can never exist.  
🗑
False   Create an extra thread to release the locks at random intervals to breakup a deadlock is a possible strategy to prevent deadlocks when multiple threads will need to acquire multiple locks.  
🗑
True   Tracking the availability of a limited resource is a common use case for a counting semaphore.  
🗑
False   Tracking how long a program has been running is a common use case for a counting semaphore.  
🗑
False   Calling the semaphore's release() method signals another thread waiting to acquire the semaphore.  
🗑
False   The semaphore's release() method increments its value if the counter is positive.  
🗑
False   The binary semaphore will have a value of 0, 1, 2, 3, etc.  
🗑
False   Distributed architecture consists of a chained-together series of producer-consumer pairs.  
🗑
False   The consumption rate should be less than or equal to the production rate in a producer-consumer architecture.  
🗑
False   A Semaphore is different from a Mutex in such a way that both can be released by different threads.  
🗑
True   Threads reuse threads to reduce the overhead that would be required to create a new, separate thread for every concurrent task.  
🗑
False   A deadlock avoidance algorithm dynamically examines the system storage state to ensure that a circular wait condition can never exist.  
🗑
False   A deadlock avoidance algorithm dynamically examines the resources to ensure that a circular wait condition can never exist.  
🗑
True   Pipe is a synchronization tool?  
🗑
Stop subdividing the current problem and solve it   What does a divide-and-conquer algorithm do when it reaches the base case?  
🗑
The Callable interface's call() method returns a result object but the Runnable interface's run() method does not   What is the difference between Java's Callable and Runnable interfaces?  
🗑
Farace conditionlse   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   Track how many threads the program has created is a common use case for a counting semaphore.  
🗑
False   The semaphore's release() method always decrements the counter's value.  
🗑
False   The binary semaphore can only be acquired and released by the same thread.  
🗑
True   The average rates of production and consumption has not relation in a producer-consumer architecture?  
🗑
Signal another thread waiting to acquire the semaphore   In addition to modifying the counter value, what else does calling the semaphore's release() method do?  
🗑
False   The Runnable interface's run() method can have an optional return value, but the Callable interface's call() method is required to always return an object.  
🗑
True   A future is a task that can be assigned to a thread pool for execution.  
🗑
False   When using a thread pool in Java, the programmer assigns submitted tasks to specific threads within the available pool to execute.  
🗑
True   A deadlock avoidance algorithm dynamically examines the resource allocation state to ensure that a circular wait condition can never exist.  
🗑
False   Socket is a synchronization tool?  
🗑
True   A barrier for a group of threads or processes in the source code means any thread/process must stop at this point and cannot proceed until all other threads/processes reach this barrier.  
🗑
semaphore   Which one of the following is a synchronization tool?  
🗑
True   Prioritizing the locks so that all threads will acquire them in the same relative order is a possible strategy to prevent deadlocks when multiple threads will need to acquire multiple locks.  
🗑
False   The semaphore's acquire() method increments its value if the counter is positive.  
🗑
The queue will fill up and cause an error   What happens if the producer puts elements into a fixed-length queue faster than the consumer removes them?  
🗑
pipeline   Which architecture consists of a chained-together series of producer-consumer pairs?  
🗑
holding place; wait for a certain condition before continuing execution   Condition variables serve as a _____ for threads to _____.  
🗑
False   When it reaches the base case, a divide-and-conquer algorithm recursively solves a set of smaller subproblems.  
🗑
False   Threads provide a convenient way to group and organize a collection of related threads.  
🗑
False   A deadlock avoidance algorithm dynamically examines the operating system to ensure that a circular wait condition can never exist.  
🗑
True   Semaphore is a synchronization tool?  
🗑
True   Data races can occur when two or more threads concurrently access the same memory location.  
🗑
False   The semaphore's acquire() method always decrements the counter's value.  
🗑
False   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   Why would you use the condition variable's signal() method instead of signalAll()?  
🗑
True   Condition variables work together with a mutex serving as a monitor.  
🗑
False   Condition variables work together with a process serving as a monitor.  
🗑
True   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.  
🗑
False   When it reaches the base case, a divide-and-conquer algorithm divides the problem into two smaller subproblems.  
🗑
True   A Runnable object cannot be used to create a Future.  
🗑
False   When using a thread pool in Java, the host operating system assigns submitted tasks to specific threads within the available pool to execute.  
🗑
It serves as a placeholder to access a result that may not been computed yet   What is the purpose of a future?  
🗑
False   The consumption and production rates must be exactly the same in a producer-consumer architecture.  
🗑
False   When it reaches the base case, a divide-and-conquer algorithm solves all of the subproblems that have been created.  
🗑
False   When using a thread pool in Java, the compiler assigns submitted tasks to specific threads within the available pool to execute.  
🗑
The ForkJoinPool manages a thread pool to execute its ForkJoinTasks, which reduces the overhead of thread creation   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   Calling the semaphore's release() method blocks and waits until the semaphore is available.  
🗑
False   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.  
🗑
True   The producer-consumer pattern follows FIFO method.  
🗑
False   Client-server architecture consists of a chained-together series of producer-consumer pairs.  
🗑
If the counter is positive, increment its value   What does the semaphore's release() method do to the counter value?  
🗑
True   Condition variables enable threads to signal each other when the state of the queue changes.  
🗑
True   When it reaches the base case, a divide-and-conquer algorithm stops subdividing the current problem and solve it.  
🗑
False   It's not possible to have data races without a race condition but possible to have race conditions without a data race.  
🗑
False   There is no limit on the number of threads that can possess the ReadLock while another thread has a lock on the WriteLock.  
🗑
True   Protecting a critical section of code with mutual exclusion means preventing multiple threads from concurrently executing in the critical section.  
🗑
1   What is the maximum number of threads that can possess the WriteLock of a ReadWriteLock at the same time?  
🗑
False   Try lock or try enter is a blocking version of the lock or acquire method.  
🗑
False   Data races can be hard to identify because data races are caused by hardware errors and cannot be debugged in software.  
🗑
The data race may not always occur during execution to cause a problem.   Why can potential data races be hard to identify?  
🗑
False   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.

 
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
Created by: user-1902021