Add parallelThreads option and code for the producer/consumer