* STL 병렬 알고리즘(C++17, 69개 지원)std::execution::seq싱글 스레드std::execution::par알고리즘을 병렬로 실행std::execution::par_unseq알고리즘을 병렬로 실행(vectorized, SIMD)std::execution::unseq싱글스레드(vectorized, SIMD) C++20 *atomic smart pointerstd::atomic> ptr=std::make_shared * std::shared_ptr-> 스마트 포인터 "참조계수증가/감소는 멀티스레드 환경에서 안전" 하다(C++11 부터)-> shared_ptr 자체는 스레드에 안전하지 않다.-> C++20부터 std::atomic 지원

* 지역변수 : 지역변수는 스레드에 안전하다.- 스택에 놓인다.- 스택은 스레드당 한개씩 따로 만들어진다.* static 지역변수 또는 전역변수- data 메모리에 놓인다.- 모든 스레드가 공유한다.-> 전역(static 지역) 변수는 스레드에 안전하지 않다. * std::mutex- C++ 표준이 제공하는 mutex 종류std::mutexC++11std::timed_mutexC++11std::recursive_mutexC++11std::recursive_timed_mutexC++11std::shared_mutexC++17std::shared_time_mutexC++17 - member functions lockblockstry_lockreturn falseunlock native_handle - me..
* std::promise- 스레드 사이에서 "값 또는 예외를 공유"할 수 있는 템플릿- 헤더- promise를 통해서 전달된 데이터는 std::future를 통해서 얻을 수 있다.- 스레드 생성 시 promise 객체를 참조(&,&&)로 전달한다.- set_value- set_value_at_thread_exit : 스레드가 끝날 때 값을 넣는다. set_exception으로 예외 처리 가능 * std::promise 멤버 함수set_valueset_value_at_exit_threadp.set_value() -> std::promise 객체만 사용 가능set_exceptionset_exception_at_exit_thread예외 전달get_futureswapstd::future 얻기2개의 prom..
C++ 11/14/20스레드 관리std::threadstd::promisestd::futurestd::packagedstd::async...스레드 동기화std::mutex 등 6개의 표준 뮤텍스lock을 다루는 4가지 기술conditional_variable, semaphore,TLS, call_once..atomic operationstd::atomic, std::memory_order..STL과 concurrency병렬 알고리즘, atomic smart pointerC++20 기술std::semaphore, std::jthread, std::barrier, std::atomic, std::atomic_ref.. 빌드하는 방법g++g++ 소스.cpp -std=c++20환경에 따라 "-lpthread"가..
- Total
- Today
- Yesterday
- shared_ptr
- syncronization
- 동적계획법
- std::counting_semaphore
- 다이나믹프로그래밍
- 영어작문
- std::shared_ptr
- scoped_lock
- conditional_variable
- std::future
- c++동기화
- Everyday
- C++
- 유폰
- std::unique_lock
- semaphore
- atomic
- 영어글쓰기
- 백준
- Future
- std::async
- std::promise
- every day
- Async
- Thread
- 민병철유폰
- unique_lock
- the same
- step4
- std::atomic
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |