본문 바로가기
Computer Science/운영체제

[운영체제] Pthread 개요

by Sky Titan 2020. 9. 14.
728x90

3가지 thread 라이브러리

  1. POSIX pthread
  2. Windows thread API
  3. Java thread API

Pthread

- user-level과 kernel-level에서 둘 다 실행되지만 보통 kernel-level에서

Windows thread

- kernel-level 라이브러리

Java thread

- 더 high level의 라이브러리

- pthread와 Windows thread 라이브러리 둘 다 호출

Pthread API

- create, terminate, join, detach

- synchronization

Thread pool

- 스레드를 사용하는 실행 모델

- 기존 방식 : 새 요청 들어옴 -> 새로운 스레드 생성 및 요청 처리 -> 완료되면 스레드 파괴

- 기존 방식의 문제점 : 스레드 생성/파괴 시 오버헤드 발생, 스레드 생성에 제한이 없음

- Thread pool 방식 : 고정된 수의 스레드들 미리 생성 -> 새 요청 들어옴 -> thread pool에서 사용가능한 스레드들 선택 -> 완료되면 thread pool로 반환

 

thread pool

 

728x90

댓글