Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key


Play button


Play button




Click to flip

28 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
The illusion that two or more tasks are being performed in parallel. ___________ is created by an operating kernel's support of multiple threads.
A _______ has a self-contained execution environment; a complete, private set of basic run-time resources; in particular, each has its own memory space.
These exist within a process — every process has at least one. They share the process's resources, including memory and open files. Both provide an execution environment, but creating a new ______ requires fewer resources than creating a new process.
To abstract thread management from the rest of your application, pass the application's tasks to an _________.
The ________ interface should be implemented by any class whose instances are intended to be executed by a thread. The class must define a method of no arguments called run.
The Runnable interface defines method ____, meant to contain the code executed in the thread.
The Thread class implements Runnable, though its run method does nothing. An application can ________ Thread, providing its own implementation of run.
What code is used to cause the current thread to suspend execution for a specified period?
The join method allows one thread to wait for the completion of another. If 't' is a Thread object whose thread is currently executing, this code:


causes the current thread to pause execution until t's thread terminates. Overloads of join allow the programmer to specify a waiting period.
Thread ____________ happens when two operations, running in different threads, but acting on the same data, interleave. This means that the two operations consist of multiple steps, and the sequences of steps overlap.
True or False: When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object suspend execution until the first thread is done with the object.
________ describes a situation where two or more threads are blocked forever, waiting for each other.
__________ describes a situation where a thread is unable to gain regular access to shared resources and is unable to make progress. This happens when shared resources are made unavailable for long periods by "greedy" threads.
A thread often acts in response to the action of another thread. If the other thread's action is also a response to the action of another thread, then ________ may result. As with deadlock, these threads are unable to make further progress. However, the threads are not blocked — they are simply too busy responding to each other to resume work.
A _______ _____ invokes Object.wait to suspend the current thread. The invocation of wait does not return until another thread has issued a notification that some special event may have occurred — though not necessarily the event this thread is waiting for: wait();
guarded block
Note: Always invoke wait(); inside a loop that tests for the condition being waited for. Don't assume that the interrupt was for the particular condition you were waiting for, or that the condition is still true. ( while(!condition) {} )
There are three types of executor interfaces defined in java.util.concurrent, which one is this:

A simple interface that supports launching new tasks.
Trick question.
The Executor interface provides a single method, execute, designed to be a drop-in replacement for a common thread-creation idiom. If r is a Runnable object, and e is an Executor object you can replace

(new Thread(r)).start();

with what statement?
The ExecutorService interface supplements execute with a similar, but more versatile ______ method. Like execute, this method accepts Runnable objects, but also accepts Callable objects, which allow the task to return a value. This method returns a Future object, which is used to retrieve the Callable return value and to manage the status of both Callable and Runnable tasks.
The ScheduledExecutorService interface supplements the methods of its parent ExecutorService with ________, which executes a Runnable or Callable task after a specified delay.
This type of pool always has a specified number of worker threads running; if a thread is somehow terminated while it is still in use, it is automatically replaced with a new thread. Tasks are submitted to the pool via an internal queue, which holds extra tasks whenever there are more active tasks than threads.
Fixed Thread Pool
What exactly would this code do?

Executorservice threadExecutor = Executors.newFixedThreadPool(3);
This code would create a new fixed thread pool with a maximum of 3 threads available.
The ___________________ method creates an executor with an expandable thread pool. This executor is suitable for applications that launch many short-lived tasks.
To directly control thread creation and management, simply instantiate class ______ each time the application needs to initiate an asynchronous task.
To make a method synchronized, simply add the ____________ _______ to its declaration.
synchronized keyword
There are three types of executor interfaces defined in java.util.concurrent, which one is this:

A subinterface of Executor, which adds features that help manage the lifecycle, both of the individual tasks and of the executor itself.
There are three types of executor interfaces defined in java.util.concurrent, which one is this:

A subinterface of ExecutorService, supports future and/or periodic execution of tasks.
The ScheduledExecutorService interface defines ___________________ and ______________________, which executes specified tasks repeatedly, at defined intervals.
scheduleAtFixedRate and scheduleWithFixedDelay
The _______________________ method creates an executor that executes a single task at a time.