How to let tokio-rs know which Cores to use

In my current program I have to pin threads to handle cpu-intensive tasks, but I also use tokio-rs to take care of network I/O tasks.

Will tokio-rs try to use threads from the Cores I have allocated to dedicated tasks?

The goal would be, if the machine has 10CPUs, allocate 6 of them to intensive jobs, and 4 of them for I/O network jobs

I have taken a look at worker_threads, but I'm unsure if it tokio-rs will try to use the threads from the CPUs i have allocated to cpu-intensive tasks -- Builder in tokio::runtime - Rust

Tokio does not do anything special to pick cores for its threads. It just spawns them with std::thread::spawn, and then the default behavior will be applied. If the default behavior is not sufficient for you, then you can use on_thread_start to change the options for where the Tokio threads will be scheduled.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.