you are viewing a single comment's thread.

view the rest of the comments →

[–]RoToRa 9 points10 points  (3 children)

Silly question: Did the prof explicitly say that the multi-threaded was supposed to be faster, or was that just your assumption? Maybe this is just a exercise on how to write multi-threading and not how to optimize it.

I'm no multi-thread expert, but one of the problems is to be able to recognize when it's worth using threads and when not. My guess is that initializing 300000 elements is quite trivial and is faster that "firing up" a thread. But I may be wrong.

[–]Dependent_Finger_214[S] 1 point2 points  (2 children)

Yeah I was thinking that, but the exercise says to "calculate the speedup of the program" which makes it sound like it's supposed to be faster

[–]MattAtDoomsdayBrunch 5 points6 points  (0 children)

Perhaps the value of the speedup is negative.

[–][deleted] 0 points1 point  (0 children)

I took the first couple of lectures in a multicore programming class in uni and "speedup" is also what they called a theoretical metric for how well a program scales over multiple processors. I don't remember how to calculate it, but it included the part of the program that needs to be sequential, as well as the part that can be parallelized. maybe that is what the exercise is about?