HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
📝
남득윤 학습 저장소
/
🧵
멀티쓰레드, 동시성 프로그래밍
/
🧵
Java Concurrency and Multithreding
/
Thread Pools in Java

Thread Pools in Java

Thread Pool Introduction

여러 작업을 동시에 (Concurrent) 처리하기 위해서는
  • 각 작업을 처리하는 쓰레드를 하나씩 만들어 처리하거나
  • 쓰레드 풀의 미리 생성된 쓰레드에 작업을 제출(submit)하여 작업을 처리할 수 있습니다.
 
쓰레드 풀을 통해 동시에 작업 중인 쓰레드의 개수를 조절 할 수있습니다.
→ 쓰레드 폭증 방지
notion image
쓰레드풀은 내부적으로 작업 큐를 가지고 있습니다.
 
 

Thread Pool Load Balancing Between Threads

  • 쓰레드풀을 통해 쓰레드의 작업에 밸런스를 맞출 수 있습니다.
  • 쓰레드풀은 그냥 available한 쓰레드가 있다면 큐에서 작업을 꺼내서 제공합니다.
 

Using the implemented Thread Pool - ThreadPool

 

The Implementation of the ThreadPool class.

 

The Implementation of the ThreadPoolRunnable class.

 
 

Summary of use of the ThreadPool implementation.