critical-sections-openmp
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| critical-sections-openmp [June 11, 2026 at 09:19] – created - external edit 127.0.0.1 | critical-sections-openmp [June 11, 2026 at 09:21] (current) – Ivan Janevski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| # Critical sections (OpenMP) | # Critical sections (OpenMP) | ||
| - | In POSIX threads, mutual exclusion is explicit: you call `pthread_mutex_lock` before a shared update and `pthread_mutex_unlock` after. **Critical sections** in OpenMP do the same thing with a pragma. The enclosed block is protected by an implicit mutex: only one thread at a time executes it, and threads that arrive while another is inside are blocked until it exits. Unlike [[atomic-openmp|`atomic`]], | + | In POSIX threads, mutual exclusion is explicit: you call `pthread_mutex_lock` before a shared update and `pthread_mutex_unlock` after. |
| + | |||
| + | **Critical sections** in OpenMP do the same thing with a pragma. The enclosed block is protected by an implicit mutex: only one thread at a time executes it, and threads that arrive while another is inside are blocked until it exits. Unlike [[atomic-openmp|`atomic`]], | ||
| ```c | ```c | ||
critical-sections-openmp.1781169565.txt.gz · Last modified: by 127.0.0.1
