Term
Threads VS. Processes.
(Differences and similarities) |
|
Definition
Threads can only operate inside a process
a lot of overhead to create a process
not a lot of overhead to create a thread when compared to a process
Threads are unknown to the kernel while processes are known |
|
|
Term
(what are shared by threads in a process, what are private per thread?) |
|
Definition
heap memory & global variables are shared among threads
register values & and a stack are private to a thread |
|
|
Term
Motivation/benefits of using threads |
|
Definition
responsiveness of a program -resource sharing -economy -ability to take advantage of multiprocessor architectures |
|
|
Term
kernel threads / user threads |
|
Definition
- user threads are visible to the programmer and are unknown to the kernel
- user level threads are faster to create and manage because no intervention from the kernel is required
-kernel threads are low level and are an intricate part of the OS
-user threads are "mapped" to kernel threads |
|
|
Term
Usage of Java threads / thread pool |
|
Definition
most common method of creating threads:
class foo implements Runnable { public void run() { //write some code in here and this will be your "thread" } }
most common way to implement a thread pool:
import java.util.concurrent.*;
class foo {
private final ExecutorService thePool; pool.execute(something); } |
|
|