The task scheduler or traffic controller, an abstract class with only static methods that is based on a producer-consumer design scheme operating on a priority queue, is used to parallelize task execution, prevent race conditions and deadlocks, and at the same time keep certain tasks grouped together and ensure that tasks belonging to the same reaction run (mostly) sequentially. For example, if the same reaction requires adding a chemical and a heating step, the task scheduler would ensure that the heating is not done before adding the reactants, just because the hotplate is currently free, but the addition hardware is currently tied up in a different, parallel reaction. At the same time, it would optimize resource use by using the hotplate in a different, parallel reaction that requires it while the first reaction is still waiting for the addition hardware to become available. It also takes care of locking and unlocking hardware components and containers to "reserve" them for certain planned steps and ensure that the same resource is not used multiple times concurrently.