-
Notifications
You must be signed in to change notification settings - Fork 0
multiprocessing
Jade Kim edited this page Sep 8, 2015
·
2 revisions
-
동시성
- 저수준 : atomic operation 을 명시적으로 사용, 인터프리터 구현에만 쓰고 언어 기능으로는 제공하지 않음
- 중간 수준 : 명시적인 lock 사용,
threading.Semaphore
,threading.Lock
,multiprocessing.Lock
- 고수준 :
concurrent.futures
,queue.Queue
,multiprocessing 큐 컬렉션 클래스
-
명시적인 lock 사용하지 않기
- 동시접근 가능한 자료구조 (자료구조 자체에서 lock 처리)
- queue 모듈의 쓰레드 안전 큐
-
multiprocessing.JoinableQueue
,multiprocessing.Queue
클래스
-
아예 lock 사용 하지 않기
- 변경 불가능한 데이터 전달
- read-only 자료구조 전달
- 변경 가능한 데이터일 경우, deep copy 해서 전달
- 메모리와 시간 비용 < lock 사용 비용
- 동시접근 지원 자료구조
-
multiprocessing.Value
,multiprocessing.Array
-
multiprocessing.Manager
를 통해 만들어져야 함.
-