2. Process-based multitasking
• Allows you to run the Java Compiler at the same time that
you are using an editor
Thread-based multitasking
• A text editor can format text at the same time that it is
printing
5.
Thread execution
◦ start() – Start a thread by calling its run() method
◦ run() – Entry point for the thread
Thread blocking
◦ sleep() – Suspend a thread for a period of time
◦ yield() – Voluntarily relinquish thread control to another
thread of the same priority
6.
Thread lifetime and termination
◦ isAlive() – Determine if a thread is still running
◦ join() – Wait for a thread to terminate
Thread communication
◦ wait() – Instructs the calling thread to give up the monitor
and sleep until some other thread enters the same monitor
and calls notify()
◦ notify() – Wakes up a thread that called wait() on the same
object
◦ notifyAll() – Wakes up all threads that called wait() on the
same object
7.
A concurrent application's ability to execute
in a timely manner is known as its liveness
Deadlock describes a situation where two or
more threads are blocked forever
◦ Starvation describes a situation where a thread is
unable to gain regular access to shared resources
◦ 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 livelock may result.
10. Semaphore
• Implements the classic semaphore
CountDownLatch
• Waits until a specified number of events have occurred
CyclicBarrier
• Enables a group of threads to wait at a predefined execution point
Exchanger
• Exchanges data between two threads