Threads Flashcards
Which Thread method enables a thread to wait on another thread before continuing its work?
join
Which Thread method executes the run method on a child thread?
start
Which term describes how responsive an application is during execution?
Liveness
Liveness
A concurrent application’s ability to execute in a timely manner is known as its liveness.
What types of problems can effect an applications liveness?
deadlock, starvation, livelock
Which term occurs when one or more threads access a shared resource so frequently that other threads are unable to gain needed access?
starvation
Which term describes controlled thread access to a shared resource, so as to reduce the likelihood of memory consistency errors between threads?
Synchronization
What is the effect of invoking the start method more than once on the same thread?
An IllegalThreadStateException is thrown.
Which term describes actions that are indivisible and cannot be stopped prematurely before they complete?
Atomicity
Which Thread attribute is used to control the relative likelihood and frequency that a thread will be given a time slice to execute?
priority
What is the Thread priority range?
1-10
Which term occurs when two or more threads are blocked forever while waiting for access to the same resource and are unable to complete their tasks?
Deadlock
Which keyword declares a method, block, or code that is limited to a single concurrent thread?
synchronized
Which term occurs when two or more threads are too busy responding to each other to complete their tasks?
livelock
Which Thread attribute is used to control whether the JVM may exit before the thread terminates?
daemon
What does the Thread.yield() method do
It provides a hint to the scheduler that the current thread is willing to yield its current use of a processor. The scheduler is free to ignore this hint.
Given: Executor ex = Executors.newScheduledThreadPool(5); How many threads will be created when passing tasks to the Executor object?
Five threads will be created; each thread supporting a single task.
Explain the Executors method:
newSingleThreadExecutor
Creates an Executor that uses a single worker thread operating off an unbounded queue. The returned executor is guaranteed not to be reconfigurable to use additional threads.
Explain the Executors method:
newCachedThreadPool
Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available.
Explain the Executors method:
newFixedThreadPool
Creates a thread pool that reuses a fixed number of threads operating off a shared unbounded queue. Number of fixed threads must be specified.
Explain the Executors method:
newScheduledThreadPool
Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically. Mujst specify the number of threads to keep in the pool even if they are idle.
what does getRawResult return for a RecursiveAction object.
null