1. A method for processing pieces of work in a plurality of stages, the method comprising: taking a lock associated with a first stage; performing a task associated with the first stage on a first piece of work; determining if a lock associated with a second stage is available; and if the lock associated with the second stage is not available, storing the first piece of work in a queue associated with the second stage and taking a second piece of work from a queue associated with the first stage and performing the task associated with the first stage on the second piece of work.