0

What scheduler does boost::asio::io_context use? Is it 1 global queue, or queue-per-core, or work-stealing queue-per-core or smth else?..

In the multiple threads case (multiple threads all using a single io_context), can I specify that it should use a global or a queue-per-core w/o work-stealing or with it? Or does it have a fixed solution for multiple threads?

I don't see it specified in the docs... like Tokio always uses a fixed work-stealing one in such cases AFAIU (https://tokio.rs/blog/2019-10-scheduler, I might've misunderstood it)

If it e.g. doesn't use work-stealing, could it in theory benefit from it?

deshalder
  • 507
  • 2
  • 13
  • You control how code is executed by where you call `io_context::run`, its up to you to define threads and how they are scheduled – Alan Birtles Jun 15 '22 at 07:27
  • @AlanBirtles, so... let's say I want to have 1st thread process 70% of `post`s (total running 2 threads); how do I do that? – deshalder Jun 15 '22 at 07:32
  • Basically I just saw a (seemingly) 1 big locked queue per `io_context` and thought if it's possible to optimize this approach to something else like multiple queues – deshalder Jun 15 '22 at 07:37
  • Yeah it's logically 1 big queue. But internally thread local queues are used to defer posting reducing lock contention. About the order of handler invocation [a lot has been written](https://stackoverflow.com/a/19963481/85371) already – sehe Jun 15 '22 at 11:47

0 Answers0