Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Lets say you have 10 threads, in one function and you want to maximize parallelity between them, what is the best way to do that:

1. with 10 mutexes, assign each mutex to a thread?
2. with semaphore (0, 10) ?
3. with array/list of mutexes?

What would you do?

Thanks,
Posted

None of them, if you are lookig for optimal parallelization you are looking for ways to avoid sychronization between the worker threads.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-May-13 23:29pm    
Good point, a 5.
—SA
None of them. All variants look like complete gibberish. And the question itself does not have exact sense. In reality, it depends on what those threads should do, so further discussion of this question simply makes no sense.

I understand that it could be a school test question. If so, leave this school. A schooling based on multiple-choice questions, especially idiotic ones, cannot teach anything.

—SA
 
Share this answer
 
v2
Comments
Francisco T. Chavez 25-May-13 23:18pm    
I agree that the solution is dependent on what the threads should do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900