Posts

Concurrency

Introducing Threads • It follows, then, that a single-threaded process is one that contains exactly one thread, whereas a multi-threaded process is one that contains one or more threads.
 • A task is a single unit of work performed by a thread.
 Distinguishing Thread Types • A system thread is created by the JVM and runs in the background of the application.
 Understanding Thread Concurrency • The property of executing multiple threads and processes at the same time is referred to as concurrency.
 • Operating systems use a thread scheduler to determine which threads should be currently executing.
 • When a thread’s allotted time is complete but the thread has not  nished processing, a context switch occurs. A context switch is the process of storing a thread’s current state and later restoring the state of the thread to continue execution.
 • Finally, a thread can interrupt or supersede another thread if it has a higher thread priority than the other thread.
 Introducing Runnabl