Concurrency Flashcards
Performing two or more tasks at the same time
Multitasking
Two or more programs run in parallel (or
concurrently)
Multiprocessing
One program that performs two or more tasks
(threads) at the same time
In thread-based multitasking, multiple threads
(multiple parts of one program) run concurrently
Multithreading
a programming practice where more than one thread
runs within a program or process.
Multithreading
Types of Multitasking
Multiprocessing & Multithreading
Every running
application has at least one thread, the ______________.
main thread
T or F:
Threads share the process’ resources, including
memory and open files.
T
A thread that is started and waiting to be executed
Ready State
A thread is being executed
Running State
5 States of a Thread
Ready, Running, Suspended, Blocked, Terminated
Execution is paused and can be resumed where it left
off
Suspended
Thread is waiting for a request (I/O) to be completed or a resource cannot be accessed because it is being
used by another thread
Blocked
Execution is stopped and cannot be resumed
Terminated
Commonly Used Thread Methods
getName(), run(), sleep(), start(), join(), getPriority()
Thread method that Suspends the thread; enables you to specify the period the thread is suspended
sleep();