Jobs

Coding test question

// Given a global variable:
workQueue = [‘task1’, ‘task2’, ‘task3’, ‘task4, task5’, ‘task6’, ‘task7’, ‘task8’];

// And a setting variable:
numberOfWorkers = 3;

// and an Asynchronous process method:
worker(task, onDone);

// Parameters:
// onDone : is a method that will be called after a worker has finished with a task
// task : needs to be one of the elements in workQueue
// Assume that worker method is already implemented and it is started in a new process and is non blocking

// Write code in any language of your choosing, that will:
// use worker() method to do tasks in workQueue
// use numberOfWorkers to determine the number of workers to run asynchronously
// Bonus: Give each worker a name and notify (print) when a task is started by a specific worker
// Bonus: Notify when all workers have finished with their tasks
// Note: paste your answer into to the Google form