Little’s Law, Multitasking and Getting Things Done
Little’s Law, Multitasking and Getting Things Done
In this article, we take a look at the mathematics of being Agile, and this can help increase your productivity and save time and money.
Join the DZone community and get the full member experience.Join For Free
[Latest Guide] Ship faster because you know more, not because you are rushing. Get actionable insights from 7 million commits and 85,000+ software engineers, to increase your team's velocity. Brought to you in partnership with GitPrime.
Little’s Law is the theorem of queuing created by John Little, a (now retired) professor at Massachusetts Institute of Technology.
Little's Law Explained
Algebraically, Little's Law is expressed as l = tw, where:
- l = the length of the queue.
- t = the rate at which items arrive or are removed from a steady state system (throughput).
- w = the wait in the queue.
Therefore, if you want to work out the wait in the queue (i.e., how long before your job is looked at), you rearrange the theorem as w=l/t.
We see that the wait is proportional to the length of the queue and inversely proportional to the processing rate. This means that if your processing rate is slow, then the larger the queue is, the longer the wait before a new entry into the queue is processed. In other words, your ability to change — to be Agile — reduces, whereas if your processing time is faster than your length in the queue, you will be processing items in the queue quickly. However, you run the risk of your system constantly starving for work.
Imagine that you have a processing rate of one story every two days. This results in a rate of 0.5 stories per day.
If we have a queue size of 1, then w = 1/0.5, or it will be two days that your story will wait in the queue before someone works on it.
Now imagine that we push two stories into the queue: w = 2/0.5
For any additional stories entering the queue, it will take four days before they are looked at, thus slowing down our agility.
Adding More Resources (Increasing Throughput)
If I add more resources, I could process things more quickly. My throughput has increased, so things should improve.
Suppose you now have two people, each capable of working on 0.5 stories per day. Your processing speed has doubled to 1 story per day, as illustrated below. With a queue depth of 1, w = 1/1.
The wait in the queue is now one day, therefore increasing our throughput.
Let’s try to increase our queue depth to 2: w = 2/1
The wait is two days. Our agility is degrading again. The more we assign to the queue, the longer it takes before the story is looked at. The problem here is that you cannot always add more people. People and resources cost money. So what else can we do?
Reduce Queue Size
Let’s try to reduce the queue size to zero. To keep things simple, we’ll go back to one person: w = 0/0.5
Our wait time is now zero. We have complete agility — the ability to change stories until they are worked on. So how do we achieve zero queue size? Well, we’re cheating a little. There is still a queue: the backlog. We are no longer assigning stories to people, so their personal "queues" (work in progress) have been reduced to zero. In other words, they are working on one story/task/item at a time and pulling new items from the backlog when they finish. This allows the changing of the backlog without affecting the work.
One of the problems with assigning tasks to people is that folks have a tendency to multitask. Another is the difference between what has been assigned to them and their thinking that they are making progress. This is actually not the case. Let me explain.
Say you have three tasks: A, B, and C. Each task takes 10 days to complete. If we complete these tasks sequentially, it's going to take 10 days to complete each task.
Now, if we do these tasks sequentially, it's going to take 10 days to complete each task.
But we are super people! We can multitask! Get everything done quicker! Is that the case? Well, let's see. Suppose we split the task so that we work five days on each task to get something done on all tasks.
We’re keeping it simple here.
So is it quicker to finish each task? Umm, no. We have actually doubled the time it takes to complete each task.
This may not matter, as the overall time for all tasks is still 30 days. The same as if we did it sequentially. The problem is that switching tasks is not without cost. We have to dump our thought process on one task and reload everything for the next task. That takes time and energy, especially if the time between multitasking is hours or minutes and not days. Second, if there is any delay in completing a "portion" of a task — for example, C took a little longer than first expected, and you spent six days instead of five — then you not only have delayed task C but also the completion of task A and B! And potentially the whole project. As a result, stakeholders of A and B escalate, because they need their projects done now, so you stop, rearrange, and the whole thing becomes a chaotic mess.
Business as usual? For most people it is. So much so that for most it's a fact of life; so much so that when developers look at how long something will take to complete, they ignore elapsed time and focus on work time. But stakeholders focus on elapsed time, so as with any mismatch, tension rises.
Caveat: I should probably mention that these techniques are not going to shorten the delivery time for a set amount of work in a perfect system without losses, such as context switching or reorganizing, regardless of whether you have a queue size of zero or 50, or whether you switch tasks every few minutes. We are not doing any magic here. Just like conserving energy, the amount of work being done overall in the system is maintained. We are rearranging things so that stuff gets done sooner, and if you prioritize your items to give the most value, you get more value sooner as well. We are also dealing with a system that has reached steady state. Thus, there is a ramp-up time when the system is loaded and variances in the work from one item to the next are minimal — something that doesn't come naturally in any knowledge-based project.
I know my math is a little off; I probably could have explained it a lot better 20 years ago when I actually did math at university, but Little’s Law does represent a mathematical model of our ability to be Agile. It shows that "pulling" increases your ability to respond to change as opposed to "assigning" work to someone. If you do assign, it shows that reducing the amount you load onto a person actually helps get things done sooner.
Finally, if you do overload someone with tasks, because we are human we tend to change the way we work between those tasks, for whatever reason. What this means is that for any one particular task, it will actually take longer to complete it, due to the switch from another task. Not only that, but a delay in one task could affect the delivery of other tasks that may be a higher priority.
So keep your work in progress small (preferably one thing at a time), try to keep the size of the work even and small in size to regulate the throughput to a steady state, and pull new work as required. You will get things done sooner, more smoothly, and we can hope that you may be one step closer to gaining control of the whole system. Better yet, you are doing this all with no additional cost!
Published at DZone with permission of Holger Paffrath , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.