일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- pandas
- Gap
- Design Pattern
- CSS
- 통신사할인
- 에라토스테네스의 체
- Codility
- 상태
- 소수
- margin
- 알고리즘
- align-items
- Photoshop
- 수학
- grid
- 강화학습
- dataframe
- SK바이오사이언스
- stl
- spring
- 포토샵
- series
- Flexbox
- c++
- 확률
- skt membership
- 백준
- Javascript
- Prefix Sums
- c
- Today
- Total
sliver__
4.5 Implicit Threading 본문
Thread Pools
The general idea behind a thread pool is to create a number of threads at start-up and place them into a pool, where they sit and wait for work. When a server receives a request, rather than creating a thread, it instead submits the request to the thread pool and resumes waiting for additional requests. If there is an available thread in the pool, it is awakened, and the request is serviced immediately. If the pool contains no available thread, the task is queued until one becomes free. Once a thread completes its service, it returns to the pool and awaits more work. Thread pools work well when the tasks submitted to the pool can be executed asynchronously.
Thread pools offer these benefits:
- Servicing a request with an existing thread is often faster than waiting to create a thread.
- A thread pool limits the number of threads that exist at any one point. This is particularly important on systems that cannot support a large number of concurrent threads.
- Separating the task to be performed from the mechanics of creating the task allows us to use different strategies for running the task. For example, the task could be scheduled to execute after a time delay or to execute periodically.
Fork Join
Fork-join model is a synchronous version of thread pools in which a library determines the actual number of threads to create.

OpenMP
OpenMP is a set of compiler directives as well as an API for programs written in C, C++, or FORTRAN that provides support for parallel programming in shared- memory environments. OpenMP identifies parallel regions as blocks of code that may run in parallel.
Below link is a lot of examples of OpenMP.
OpenMP(1) - 입문자용 주요 사용법 간단한 설명/정리(omp parallel, for, atomic,critical)
매일 GPU나 분산 컴퓨팅으로 병렬 처리만 하다가, 오랜만에 단일 cpu환경에서 thread로 병렬 처리를 해야 할 일이 생겼다. 학습하는 김에 주요 사용법을 정리해보고자 한다. 개발 환경 C/C++ OpenMP 5.0 A
dining-developer.tistory.com
Intel Thread Building Blocks
Intel threading building blocks (TBB) is a template library that supports design- ing parallel applications in C++. As this is a library, it requires no special compiler or language support.
Developers specify tasks that can run in parallel, and the TBB task scheduler maps these tasks onto underlying threads. Furthermore, the task scheduler provides load balancing and is cache aware, meaning that it will give precedence to tasks that likely have their data stored in cache memory and thus will execute more quickly. TBB provides a rich set of features, including templates for parallel loop structures, atomic operations, and mutual exclusion locking. In addition, it provides concurrent data struc- tures, including a hash map, queue, and vector, which can serve as equivalent thread-safe versions of the C++ standard template library data structures.

The TBB library will divide the loop iterations into separate “chunks” and create a number of tasks that operate on those chunks.
If you have any interest in Thread Building Block(TBB) of Intel, please refer below link.
GitHub - oneapi-src/oneTBB: oneAPI Threading Building Blocks (oneTBB)
oneAPI Threading Building Blocks (oneTBB). Contribute to oneapi-src/oneTBB development by creating an account on GitHub.
github.com
'CS > 운영체제' 카테고리의 다른 글
4.7 Operating-System Examples (0) | 2023.11.13 |
---|---|
4.6 Threading Issues (0) | 2023.11.13 |
4.4 Thread Libraries (1) | 2023.11.09 |
4.2 Multicore Programming (0) | 2023.11.08 |
4.1 Thread & Concurrency overview (0) | 2023.11.06 |