7. Multiprocessing Programming General Threading Model Main thread executes the program’s main function Main thread creates subthreads, witch execute other functions in the program. Subthreads can also create additional threads.
8. Multiprocessing Programming Benefits Increased performance and better resource utilization Even on single processor systems – for hiding latency and increasing throughput IPC thread shared memory is more efficient Risk Increases complexity of the application Difficult to debug (data races, deadlocks, etc.)
11. Programming Model Generate multi-thread code by referencing directive code Compiler is required to support openMP To eliminate synchronization and dependency
15. Clauses private(var1, …) to block sharing selected values with threads shared(var1, …) to share selected values with threads schedule(type [, chunk_size]) to divide work with threads for equality static dynamic
16. Synchronization (critical section) Declaring critical section in parallel section Running only single thread at moment #pragmaomp critical [(name)] { structured code block }