Previous | Next --- Slide 28 of 38
Back to Lecture Thumbnails
jpaulson

If the numbers are big enough for you to bother parallelizing it, the synchronization cost probably doesn't matter.

LeeK

@jpaulson What do you mean by the numbers are big enough? If a serial program is parallelized to use 4 cores, but your program ends up spending half its time synchronizing, then the cost might be significant and it might be worth doing something about it like what is mentioned in the next slide.

bscohen

It was not specifically brought up, but one other problem I imagined that might occur with a work queue is that the hardest piece of work is removed from the queue last - then every other worker sits idle while the one worker tackles the large problem.

It would've been more desirable to start the hard work up front, and then knock out the "easy" work in the mean time

martin

serialization in this program is the ratio of the sum of the black regions and the sum of the blue region.

pebbled

@LeeK What jpaulson is pointing out is that the larger the potential primes are, the greater the proportion of time the threads spend in is_prime (since the runtime of is_prime is logarithmic at best)