Finals Flashcards
(29 cards)
Contains two or more parts that can run concurrently
Multithreaded Program
The smallest unit of execution
Thread
Group of associated threads executed in the same shared environment
Process
Contains exactly one thread
Single-Threaded Process
Supports more than one thread.
Multi-Threaded Process
Threads in the same process share the same memory space and can communicate directly with one another.
Shared Environment
Property of executing multiple threads and processes simultaneously
Concurrency
Determines which threads should be currently executing.
Thread Scheduler
Process of storing a thread’s current state and later restoring the state of the thread to continue execution.
Context Switch
Special thread that is created by the Java VM to run the application.
Main Thread
What are the two ways to create a thread?
*Extend the Thread class and override the run () method
*Implement the Runnable interface
Starts a thread by calling its run method
Start()
The entry point for the thread
Run()
Sets a thread’s name
setname()
Obtains a thread’s name
getName()
Sets a thread’s priority
setPriority()
Obtains a thread’s priority
getPriority()
Determines if a thread is still running
isAlive()
Waits for a thread to terminate
Join()
Suspends a thread for a period of time
sleep()
numeric value associated with a thread that is taken into consideration by the thread scheduler
Thread Priority
Value of:
MIN_PRIORITY
MAX_PRIORITY
NORM_PRIORITY
1
10
5
Returns a reference to the Thread instance executing currentThread()
Thread.currentThread()
Associate one or more non-specified Java types upon creation. These are declared within angle brackets (<>).
Generic types