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 890259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:42:13+00:00 2026-05-15T13:42:13+00:00

My computer is a dual core core2Duo. I have implemented multithreading in a slow

  • 0

My computer is a dual core core2Duo. I have implemented multithreading in a slow area of my application but I still notice cpu usage never exceeds 50% and it still lags after many iterations. Is this normal? I was hopeing it would get my cpu up to 100% since im dividing it into 4 threads. Why could it still be capped at 50%?

Thanks

See What am I doing wrong? (multithreading)

for my implementation, except I fixed the issue that that code was having

  • 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-05-15T13:42:14+00:00Added an answer on May 15, 2026 at 1:42 pm

    Looking at your code, you are making a huge number of allocations in your tight loop–in each iteration you dynamically allocate two, two-element vectors and then push those back onto the result vector (thus making copies of both of those vectors); that last push back will occasionally cause a reallocation and a copy of the vector contents.

    Heap allocation is relatively slow, even if your implementation uses a fast, fixed-size allocator for small blocks. In the worst case, the general-purpose allocator may even use a global lock; if so, it will obliterate any gains you might get from multithreading, since each thread will spend a lot of time waiting on heap allocation.

    Of course, profiling would tell you whether heap allocation is constraining your performance or whether it’s something else. I’d make two concrete suggestions to cut back your heap allocations:

    • Since every instance of the inner vector has two elements, you should consider using a std::array (or std::tr1::array or boost::array); the array “container” doesn’t use heap allocation for its elements (they are stored like a C array).
    • Since you know roughly how many elements you are going to put into the result vector, you can reserve() sufficient space for those elements before inserting them.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Even though I have a robust and fast computer (Pentium Dual Core 2.0 with
I've got a decent computer. ( something with dual-core in the name and a
On Computer A (my computer), I have a Perl script that accesses a file
The computer is connected to measuring device via a physical COM1. I have simple
Are computer languages copyrighted or have some restrictions imposed on them how they can
have 2 questions : A computer with 32-bit address uses 2-level page table (9
I have made an application project in Visual Studio 2008 C#, SQL Server from
My computer crashed recently. We have a Delphi app that takes a lot of
Possible Duplicate: Slow Android emulator is it my computer's hardware limitation? it has 1024
Any computer language have 'expression' and 'statement'. in concept, what's the diff?

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.