# coroutines

Gilles Barbier

12/10/2020, 6:13 PM
Hello, I'm writing a worker using kotlin, I receive messages from a channel (from a queuing system) - those messages trigger the processing of tasks that I do not manage (user can add its own). To run n job in parallel, I have n coroutines constantly pulling from this channel and running the jobs. I did some tests with CPU intensive jobs (with plain not suspended java) and apparently it works - jobs are processed in parallel - but I do not understand how/why ?! Do you have an explanation ?
I think I've understood: a new thread is used for each job, while there is one available in an underlying thread pool.