Warum ist OpenMP effizienter als PThreads?

... komplette Frage anzeigen

1 Antwort

Dazu gibt es ein paar sehr gute Diskussionen bei Stackoverflow:
Auf http://stackoverflow.com/questions/935467/parallelization-pthreads-or-openmp?lq=1 wird zB der Vergleich zu "C vs Assembler" gezogen. Mit C = OpenMP und Assembler = PThreads.

Die beiden Konzepte arbeiten auf unterschiedlichen Abstraktionsbenen - mit allen Vor- und Nachteilen.

Pthreads is a very low-level API for working with threads. Thus, you have extremely fine-grained control over thread management (create/join/etc), mutexes, and so on. It's fairly bare-bones.

On the other hand, OpenMP is much higher level, is more portable and doesn't limit you to using C. It's also much more easily scaled than pthreads. One specific example of this is OpenMP's work-sharing constructs, which let you divide work across multiple threads with relative ease. (See also Wikipedia's pros and cons list.)

That said, you've really provided no detail about the specific program you're implementing, or how you plan on using it, so it's fairly impossible to recommend one API over the other.

Antwort bewerten Vielen Dank für Deine Bewertung

Was möchtest Du wissen?