Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 1
    That is a very interesting aspect. It's like doing a breadth-first search if you suspcet the desired item is in a shallow section. Commented Sep 2, 2020 at 7:24
  • this is much harder to implement than just spawning more independant threads This will depend on the programming language. Commented Sep 2, 2020 at 13:41
  • 1
    This is because you are often looking for something, and you stop as soon as one core finds the answer - a stop after one core finds a result gives you a K speedup, not a >K speedup. otherwise, how do you actually define a K speedup? Commented Sep 2, 2020 at 20:22
  • 1
    Imagine your search must make a "lucky first choice", with 50/50 chance of being right (for example, it must pick an integer and the integer must be even). Once you have picked even you find the answer in 1s, if you pick odd it will take 1,000s to prove wrong The average time of one run is .5 + (.5*.5)*1001 + (.5*.5*.5)*2001 + ..., which is at least > 500. Now imagine we start 10 processes off at the same time on one CPU. It will take them 10 seconds to get to answer if they are "fast", but there is only a 1/1024 chance none of them will be lucky, so our speedup is much more than 10x Commented Sep 3, 2020 at 6:25
  • 1
    It's worth mentioning that when a task is parallelized, it is often broken up into convenient chunks, rather than chunks that require the same amount of time. If the threads must occasionally synchronize, then you will always be waiting for the slowest thread to finish. In this case it is better to use more threads than cores so that your cores aren't idle while waiting for the slowest one to finish its work. Commented Sep 10, 2020 at 10:32