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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:31:34+00:00 2026-06-13T07:31:34+00:00

For school we got a task to create a multithreaded application. We chose to

  • 0

For school we got a task to create a multithreaded application. We chose to make a multithreaded implementation of merge sort.

We however can’t manage to make it work faster than the serial implementation.

I have already tried the following:

  • implementation with unlimited threads (code example 1) (was extremely slow)
  • implementation with limited threads (code example 2) (4 threads max – still really slow)
  • implementation using Parallel.Invoke (code example 3) (still slower)
  • complex implementation also with a parallel merge function (just shamefully slow)

When I use the analyze tools in Visual Studio (Instrumentation part) I found the timings for the functions called and the threaded solution is always extremely slower than the serial implementation.

I can’t see any possible reason for this.

(for example: with 5000000 numbers to sort; serial implementation: 16.717,17; parallel: 20.259,97; results with just 1 extra thread)

I tested it on both machines I own:

  • Intel Core 2 Quad Q9450 @ 2.66Ghz
  • Intel Core i7 Q720 @1.60Ghz

I can’t for my life figure out how this is possible, shouldn’t this just speed up the process?

I would be really greatefull if somebody would be able to help me out.

code example 1:

ParallelMerge pMerge = new ParallelMerge(T, p1, q1 -1, p2, q2-1, A, p3);
Thread thread = new Thread(new ThreadStart(pMerge.parallel_merge));
thread.Start();

ParallelMerge pMerge2 = new ParallelMerge(T, q1 + 1, r1, q2, r2, A, q3 + 1);
pMerge2.parallel_merge();
thread.Join();

code example 2:

if(depthRemaining > 0)
{
   ParallelMerge pMerge = new ParallelMerge(T, p1, q1 -1, p2, q2-1, A, p3);
   thread thread = new Thread(new ThreadStart(pMerge.parallel_merge));
   thread.Start();
   ParallelMerge pMerge2 = new ParallelMerge(T, q1 + 1, r1, q2, r2, A, q3 + 1);
   pMerge2.parallel_merge(); 
   thread.Join();
}
else
{
   ParallelMerge pMerge = new ParallelMerge(T, p1, q1 -1, p2, q2-1, A, p3);
   pMerge.parallel_merge(); 
   ParallelMerge pMerge2 = new ParallelMerge(T, q1 + 1, r1, q2, r2, A, q3 + 1);
   pMerge.parallel_merge(); 
}

code example 3:

if (depthRemaining > 0)
{
   Parallel.Invoke(
      () => threaded_merge_sort(getallen, p, q, depthRemaining-1));

   threaded_merge_sort(getallen, q + 1, r, 0);
}
else
{
   threaded_merge_sort(getallen, p, q, 0);
   threaded_merge_sort(getallen, q+1, r, 0);
}
  • 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-13T07:31:35+00:00Added an answer on June 13, 2026 at 7:31 am

    it seems the problem wasn’t with the code but with the analysing tools from VS.

    -Arne Claerebout

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

Sidebar

Related Questions

I've got a task to create a webservice for school. The problem is for
I got school task again. This time, my teacher gave me task to create
I've sort of just finished a mandatory task at school, and I'm about to
In school we just got introduced to the binary search algorithm. However, in our
So, at school we got an assignment to make a car in OOP, until
I got a task at school to write an FTP program in C language
The problem is like that: a school has got different classes. Each class has
I've got a school project, kind of huge, and only a few days left,
So we've got some old-school Firefox extension code that uses the DOM3 methods get/setUserData()
In school I am part of a team of four working to create a

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.