Let's start with the basic question: What is the disruptor? The disruptor is
a concurrency framework for Java that allows data sharing between threads.
The age old way of coding a producer-consumer model is to use a queue as the
buffer area between the producer and the consumer, where the producer adds
data objects to the queue, which are in turn processed by the consumer.
However, such a model does not work well at the hardware level and ends up
being highly inefficient. The disruptor in its simplest form replaces the
queue with a data structure known as the ‘ring buffer'. Which brings us to
the next question, what is the ring buffer? The ring buffer is an array of
fixed length (which must be a power of 2), it's circular and wraps. This data
structure is at the core of what makes the disruptor super fast.
Let's explore a simple everyday scenario in enterprise archit... (more)
At a time where the clock speeds of processors have been stable over the past
couple of years, and Moore's Law is instead being applied by increasing the
number of processor cores, it is getting more important for applications to
use concurrent processing to reduce run/response times, as the time slicing
routine via increased clock speed will no longer be available to bail out
slow running programs.
Carl Hewitt proposed the Actor Model in 1973 as a way to implement unbounded
nondeterminism in concurrent processing. In many ways this model was
influenced by the packet switching m... (more)
A deadlock is a situation where two or more threads are blocked while waiting
to obtain locks that some of the other threads in the deadlock are holding.
Deadlocks can occur when multiple threads need the same locks, at the same
time, but obtain them in different order. For instance, if thread 1 locks A,
and tries to lock B, and thread 2 has already locked B, and tries to lock A,
a deadlock arises. Thread 1 can never get B, and thread 2 can never get A. In
addition, neither of them will ever know. They will remain blocked on each of
their objects, A and B, forever.
Deadlock Dete... (more)