Thinking about Kanban, I realized that the queuing-theory behind the SW-development-methodology obviously also applies to concurrent software. Now I'm looking for whether this kind of thinking is explicitly applied in some area.

A simple example: We usually want to limit the number of threads to avoid cache-thrashing (WIP-Limits).

In the paper about the disruptor pattern[1], one statement that I found interesting was that producer/consumers are rarely balanced so when using queues, either consumers wait (queues are empty), or producers produce more than is consumed, resulting in either a full capacity-constrained queue or an unconstrained one blowing up and eating away memory. Both, in lean-speak, is waste, and increases lead-time.

Does anybody have examples of WIP-Limits, reducing/eliminating queues, pull or single piece flow being applied in programming?


  • 3
    On the manufacturing line, if a person has to wait a non-trivial amount of time to get inputs they need, or to get the card for what they produce, they may go over to the blocking workstation and help with that work. / With threads, when a thread blocks on (reading or writing) a queue, it releases the CPU core to go work on other threads. / If you think of CPU cores as "people", then you'll see that what's happening is an extreme form of "going to help where it's most needed."
    – Jeff Grigg
    Oct 31, 2011 at 16:29

2 Answers 2


Typical application of WIP limit in programming is any type of pool:

  • Thread pool
  • Connection pool
  • Object pool
  • etc.

You know that your resources are somehow constrained and you can constrain them be allowing only specific number of resources. Any other work item requesting a resource must wait till any resource in use is returned back in the pool.

It also solves problems with expensive construction of resources and it can be further improved to solve management of resources when only small number of work items is generated (the size of the pool can dynamically change between allowed thresholds).

  • Thanks for this example. Thinking about this, I also remembered the Fail Fast pattern in Peter Nygard's "Release It". In addition to the WIP limit on the pool, one can limit the queue and fail a call if it is likely to time out or take longer than acceptable.
    – Christoph
    Nov 1, 2011 at 18:12

I just recently came across the KanbanFlow pattern which seems almost identical to the Disruptor PDF you posted. You can see a simulation of the idea here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.