Using Channels with threads for a data pipeline

I’m a kotlin newbie using channels to implement a data pipeline. for higher throughput of data i need threads. i’ve implemented it the following way:

https://try.kotlinlang.org/#/UserProjects/7t1259klqnaa4q494pghbkmso5/dtljtf4dpo1dmbcl7irqvseru6

first i’m creating threads

 val threads = Array(workers) {
        newSingleThreadContext("worker-${it}")
    }

then I assign them

 val consumer = Array(workers) {
         produce(threads[it]) {
             println("${Thread.currentThread().name} Start Consumer")
             ...
             send("finished")
        }
    }

So I’m asking, is this a ok? is there a better way to do it?

Thanks!

Can you avoid to use a dedicated thread pool?
Are you considered built-in dispatchers?

Well the question is, can i avoid a dedicated thread pool, if i want max throughput? which built in dispatchers could i use as alternative? thx!

Yes, you can.
See dispatchers documentation for further details.