[운영체제] 스레드 상태 Thread status
상태 종류
Thread.getState() 메서드를 통해 상태를 확인 가능하다.
NEW
A thread that has not yet started is in this state.
아직 시작되지 않은 스레드
RUNNABLE
A thread executing in the Java virtual machine is in this state.
Java 가상 머신에서 실행 중인 스레드
BLOCKED
A thread that is blocked waiting for a monitor lock is in this state.
모니터 잠금을 기다리며 차단된 스레드
WAITING
A thread that is waiting indefinitely for another thread to perform a particular action is in this state.
다른 스레드가 특정 작업을 수행할 때까지 무기한 대기 중인 스레드
TIMED_WAITING
A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.
지정된 대기 시간까지 다른 스레드가 작업을 수행하기를 기다리고 있는 스레드
TERMINATED
A thread that has exited is in this state.
종료된 스레드
Lifecycle
스레드 상태는 크게 5개 순서로 나뉜다.
1. New
2. Runnable
3. Running
4. Blocked (Non-runnable state)
5. Dead
참고: https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html
Thread.State (Java Platform SE 7 )
Thread state for a waiting thread. A thread is in the waiting state due to calling one of the following methods: A thread in the waiting state is waiting for another thread to perform a particular action. For example, a thread that has called Object.wait()
docs.oracle.com
사진 출처: https://www.scientecheasy.com/2020/08/life-cycle-of-thread-in-java.html/
Life Cycle of Thread in Java | Thread State - Scientech Easy
Learn life cycle of thread in Java, thread state in Java: newborn, runnable, running, non runnable (blocked), dead are five states of thread life cycle
www.scientecheasy.com