Deadlock describes a situation where two or more threads are blocked
forever, waiting for each other. Deadlock occurs when multiple
threads need the same locks but obtain them in different order. A
Java multithreaded program may suffer from the deadlock condition
because the synchronized keyword causes the executing thread to
block while waiting for the lock, or monitor, associated with the
specified object.
ALGORITHMS
DEADLOCK
A deadlock occurs when a process or thread enters a waiting
state because a requested system resource is held by another
waiting process, which in turn is waiting for another
resource held by another waiting process.
Concurrency is the execution of the multiple instruction
sequences at the same time. It happens in the operating
system when there are several process threads running in
parallel. The running process threads always communicate
with each other through shared memory or message passing.
In computer science, a semaphore is a variable or abstract
data type used to control access to a common resource by
multiple processes in a concurrent system such as a
multitasking operating system