Multithreading: Common Pitfalls

Deadlocks, Starvation, Livelock and Race Conditions If I had an hour to solve a problem I’d spend 55 minutes thinking about the problem and 5 minutes thinking about solutions. – Albert Einstein  Deadlocks, starvation, and race conditions are the bane of multithreaded programming and they can bring down any system in which they occur. Defining the […]

Multithreading: Dining Philosophers Problem

The Problem According to Wikipedia the Dinning Philosophers Problem is described as follows: Five silent philosophers sit at a table around a bowl of spaghetti. A fork is placed between each pair of adjacent philosophers. (An alternative problem formulation uses rice and chopsticks instead of spaghetti and forks.) Each philosopher must alternately think and eat. However, a philosopher can only […]

Multithreading: Producer Consumer Problem

According to Wikipeida the Producer Consumer Problem is defined as: In computing, the producer–consumer problem (also known as the bounded-buffer problem) is a classic example of a multi-process synchronization problem. The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue.  In essence, the producer consumer problem occurs in multithreaded processes when there is a […]