Parallel Merge Sort with threads /much/ slower than Seq. Merge Sort. Help

后端 未结 3 947
旧巷少年郎
旧巷少年郎 2020-12-20 10:20

http://pastebin.com/YMS4ehRj

^ This is my implementation of parallel merge sort. Basically what I do is, For every split, the first half is handled by a thread where

3条回答
  •  礼貌的吻别
    2020-12-20 11:20

    Given you have a finite number of cores on your system, why would you want to create more threads than cores?

    Also, it isn't clear why you need to have a mutex at all. As far as I can tell from a quick scan, the program doesn't need to share the threads[lthreadcnt] outside the local function. Just use a local variable and you should be golden.

提交回复
热议问题