Saturday, April 6, 2013

Explain the threading Jargon


Race Condition
A race condition occurs when the correctness of a computation depends on the relative timing of multiple threads by the runtime. In this scenario Getting the right result relies on the lucky timings.

Dead Lock
Dead lock occurs when two or more threads are blocked forever, waiting for each other to release up the shared resource. For two threads, it happens when two threads have a circular dependency on a pair of synchronized shared resources.

Starvation
Describes a situation where a thread is unable to gain regular access to shared resource and is unable to make any progress
This happens when shared resources are made unavailable for long periods by "greedy" threads. For example, suppose an object provides a synchronized method that often takes a long time to return. If one thread invokes this method frequently, other threads that also need frequent synchronized access to the same object will often be blocked.

Mutex
Mutex stands for mutually exclusive, only one kind of operation (READ or WRITE) is allowed at a given time frame.

Live Lock
A thread often acts in response to the action of other threads, if the other thread's action is also in response to another thread, then live lock may result. No progress but threads are not blocked.

Synchronizer
A synchronizer is any object that coordinates the control of flow of threads based on its state. For example, semaphore, CountDownLatch, FutureTask, Exchanger, CyclicBarrier, etc.

Latch
A synchronizer that can delay the progress of threads until it reaches the terminal state.

Semaphore
Counting semaphore are used to control the number of activities that can access a certain shared resource or perform a given action at the same time. Semaphores are normally used implement resource pool or to impose a bound on a collection.

Exchanger
A two party barrier in which the parties exchange data at the barrier point.

No comments:

Post a Comment

Your comment will be published after review from moderator