Deck 6: Concurrency and Deadlock in Database Systems: Exploring Monitor Implementation and Thread Synchronization in Java
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/19
Play
Full screen (f)
Deck 6: Concurrency and Deadlock in Database Systems: Exploring Monitor Implementation and Thread Synchronization in Java
1
Which of the following is not a reason why the programming community is so intent on concurrent programming?
A) Concurrent programming enables us to express more natural solutions to problems that are inherently parallel.
B) The true hardware parallelism possible with multiprocessors and distributed systems can only be harnessed through concurrent programming.
C) Concurrent programs are easier to write, debug, modify and prove correct than sequential programs.
D) Systems such as air traffic control systems, mission-critical systems, and real-time process control systems can benefit from concurrent programming.
A) Concurrent programming enables us to express more natural solutions to problems that are inherently parallel.
B) The true hardware parallelism possible with multiprocessors and distributed systems can only be harnessed through concurrent programming.
C) Concurrent programs are easier to write, debug, modify and prove correct than sequential programs.
D) Systems such as air traffic control systems, mission-critical systems, and real-time process control systems can benefit from concurrent programming.
Concurrent programs are easier to write, debug, modify and prove correct than sequential programs.
2
________ supports concurrent programming, in addition to many features needed to implement real concurrent systems.
A) Java
B) Visual Basic .NET
C) Python
D) all of the above
A) Java
B) Visual Basic .NET
C) Python
D) all of the above
all of the above
3
________ is a software architectural technique that improves modularity and facilitates the development of more reliable software systems.
A) Mutual exclusion
B) Multithreading
C) Information hiding
D) Concurrent programming
A) Mutual exclusion
B) Multithreading
C) Information hiding
D) Concurrent programming
Information hiding
4
To avoid indefinite postponement, a monitor ________.
A) terminates newly arriving threads when other threads are waiting
B) gives a higher priority to waiting threads than to newly arriving ones
C) terminates waiting threads when new threads arrive
D) gives a higher priority to newly arriving threads than to waiting ones
A) terminates newly arriving threads when other threads are waiting
B) gives a higher priority to waiting threads than to newly arriving ones
C) terminates waiting threads when new threads arrive
D) gives a higher priority to newly arriving threads than to waiting ones
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
5
Monitors implement ________ between threads of execution.
A) mutual exclusion
B) synchronization
C) both a and b
D) none of the above
A) mutual exclusion
B) synchronization
C) both a and b
D) none of the above
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
6
A thread can exit a monitor by ________.
A) completing execution of the code protected by the monitor
B) sleeping inside the monitor
C) waiting on a condition variable
D) both a and c
A) completing execution of the code protected by the monitor
B) sleeping inside the monitor
C) waiting on a condition variable
D) both a and c
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
7
Monitor initialization ________.
A) occurs each time a thread returns a resource
B) typically sets a variable indicating that the monitor initially is in use
C) occurs only once, before threads begin using the monitor
D) occurs each time a thread requests access to a resource
A) occurs each time a thread returns a resource
B) typically sets a variable indicating that the monitor initially is in use
C) occurs only once, before threads begin using the monitor
D) occurs each time a thread requests access to a resource
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following statements about using a circular buffer to implement print spooling is false?
A) The despooler thread tends to run at a slower speed than the spooler thread.
B) A circular buffer can "take up the slack" resulting from the mismatch in the speeds of the spooler and despooler threads.
C) If the system always generates print lines faster than the printer can print them, the buffer will always be full.
D) The spooler thread tends to run at a slower speed than the despooler thread.
A) The despooler thread tends to run at a slower speed than the spooler thread.
B) A circular buffer can "take up the slack" resulting from the mismatch in the speeds of the spooler and despooler threads.
C) If the system always generates print lines faster than the printer can print them, the buffer will always be full.
D) The spooler thread tends to run at a slower speed than the despooler thread.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
9
If the producer and consumer work at approximately the same speed, using the circular buffer can ________ the average speed of the application.
A) decrease
B) have no effect on
C) increase
D) none of the above
A) decrease
B) have no effect on
C) increase
D) none of the above
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
10
In the readers/writers problem, cascading in readers ________.
A) forces all arriving threads to wait
B) continues until all waiting readers have become active
C) allows waiting readers to become active as soon as another reader finishes
D) all of the above
A) forces all arriving threads to wait
B) continues until all waiting readers have become active
C) allows waiting readers to become active as soon as another reader finishes
D) all of the above
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
11
________ is important for preventing indefinite postponement in the readers/writers problem.
A) Giving preference to waiting readers over waiting writers
B) Ensuring that no writer thread is waiting to write when a new reader begins reading
C) Forcing that arriving readers to wait while waiting readers are cascading
D) all of the above
A) Giving preference to waiting readers over waiting writers
B) Ensuring that no writer thread is waiting to write when a new reader begins reading
C) Forcing that arriving readers to wait while waiting readers are cascading
D) all of the above
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
12
Which type of monitor allows a thread inside the monitor to signal that the monitor will soon become available, but still maintain a lock on the monitor until it exits?
A) signal-and-exit
B) signal-and-wait
C) signal-and-continue
D) signal-and-wake
A) signal-and-exit
B) signal-and-wait
C) signal-and-continue
D) signal-and-wake
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
13
In Java, a(n)________ is a queue of threads awaiting entry into a monitor.
A) wait set (or queue)
B) entry set
C) notified set
D) either a or b
A) wait set (or queue)
B) entry set
C) notified set
D) either a or b
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
14
In Java, a(n)________ is a queue of threads waiting to reenter the monitor for an object.
A) wait set (or queue)
B) entry set (or queue)
C) notified set
D) either a or b
A) wait set (or queue)
B) entry set (or queue)
C) notified set
D) either a or b
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
15
In Java, the ________ method wakes all threads in the entry and wait sets.
A) notify
B) signal
C) notifyAll
D) signalAll
A) notify
B) signal
C) notifyAll
D) signalAll
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
16
In the Java implementation of the producer/consumer relationship, the producer thread remains in the ________ until it is notified by another thread that it may proceed.
A) ready state
B) running state
C) waiting state
D) none of the above
A) ready state
B) running state
C) waiting state
D) none of the above
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
17
Methods declared as ________ encapsulate critical sections of a program that can only be occupied by one thread at a time.
A) static
B) synchronized
C) private
D) protected
A) static
B) synchronized
C) private
D) protected
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
18
The size of a circular buffer is important because ________.
A) if the number of buffer slots is too large, threads will wait more often
B) if the number of buffer slots is too small, there would be wasted memory
C) if the number of buffer slots is too small, threads will wait more often.
D) if the number of buffer slots is too large, fewer threads can access the buffer
A) if the number of buffer slots is too large, threads will wait more often
B) if the number of buffer slots is too small, there would be wasted memory
C) if the number of buffer slots is too small, threads will wait more often.
D) if the number of buffer slots is too large, fewer threads can access the buffer
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
19
Which variable(s) must be shared between threads to implement a producer/consumer relationship using a circular buffer?
A) variables that maintain read and write buffer locations
B) a variable that maintains a count of occupied buffers
C) a reference to a buffer object that holds data used by the readers/writers and provides access methods
D) all of the above
A) variables that maintain read and write buffer locations
B) a variable that maintains a count of occupied buffers
C) a reference to a buffer object that holds data used by the readers/writers and provides access methods
D) all of the above
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck