Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8093459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:30:28+00:00 2026-06-05T20:30:28+00:00

I am not much experienced in boost::asio . I’ve some pretty basic questions. Do

  • 0

I am not much experienced in boost::asio. I’ve some pretty basic questions.

Do I need to have a different io_service, and a different socket under a different thread but one single acceptor, to process a client in a threaded server ?

I believe I must have a different socket for a new client. But if all threads use the same io_service would it be parallel ?

I was going through http://en.highscore.de/cpp/boost/index.html in asio section
which says I need to have different io_services in different threads to achieve parallelization.

I if I plan to make a Server class that creates a new TCPsession each time a new client appears in acceptor.async_accept
and TCPSession ctor creates an io_service and a thread and runs that io_service.run() in its own thread would it be a good design ?

However in this design where would I join all these threads ? do I need another io_service for main so that it doesn’t terminate even before getting a new Client ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:30:29+00:00Added an answer on June 5, 2026 at 8:30 pm

    Single io_service running in a single thread can servce all the asio objects in your project. In such a design the i/o still would be “parallel” in the sense that it’s non-blocking, asynchronous; but since io_service::run() is being run in one single thread, all the completion handlers would be invoked serially, one-by-one.

    To scale your networking module over multiple CPUs, you can use one of the two approaches: thread-per-core, io_service-per-core – see HTTPServer2 and HTTPServer3 examples.

    In any case, creating a thread or io_service per TCPSession seems to me an unnecessary overhead – think of a case where you’ve got thousands of TCPSessions…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not experienced with SQL queries too much so I'm having some trouble in
Apologies if this doesn't make sense, i'm not much of an experienced programmer. Consider
I'm currently extending a Site and do not have much experience with symfony. Currently
I have 4 years experience on DotNet, not much. I now learned developing for
I have a fair amount of JSP and JSF experience. Not so much with
I'd like to generate heatmaps pretty much like the ones in this article: http://www.gazehawk.com/blog/experienced-users-view-reddit-differently/
i'm using git to manage my project, but i'm not much experienced in this
I'm designing a relational database, but I'm not too much experienced, so I'd like
I'm neither good nor experienced about asking questions so i hope I'm not doing
I'm developing an android application which uses background service. I have not had much

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.