Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[자바] Thread의 LifeCycle에 대해서 설명이 가능한지? #36

Open
SeokRae opened this issue Apr 23, 2022 · 1 comment
Open
Labels

Comments

@SeokRae
Copy link
Collaborator

SeokRae commented Apr 23, 2022

No description provided.

@SeokRae SeokRae added the 자바 label Apr 23, 2022
@NownS
Copy link
Collaborator

NownS commented Apr 28, 2022

https://github.com/prgrms-web-devcourse/BE-Team-R-CS-Study/blob/main/Java/2022-04-15-JavaThread.md
2번째 단락에 정리했던 내용 같네요!
자바에는 NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED 이렇게 6가지 생명 주기가 존재합니다

  • NEW : 쓰레드가 처음 생성되고, 아직 시작되지 않은 상태
  • RUNNABLE : 실행 가능한 상태로, JVM 내에서는 실행 중이지만 프로세서와 같은 다른 리소스를 기다리고 있는 상태, 지속적으로 컨텍스트 스위칭이 일어날 수 있는 상태
  • BLOCKED : 모니터의 lock으로 인해 멈춰 있는 상태로, synchronized 상태의 블록이나 메소드에 진입하고자 할 때 다른 스레드들이 얻는 상태 → busy-waiting
  • WAITING : 대기 중인 스레드 상태로, 시간 초과가 존재하지 않는 wait()이나 join()을 활용하여 대기 중인 상태. notify()나 notifyAll()을 이용하여 깨워 줄 수 있음 → block-wakeup
  • TIMED_WAITING : 시간 제한이 존재하는 대기 상태로, sleep()이나 timeout이 존재하는 wait, join을 이용하여 대기 중인 상태
  • TERMINATED : 스레드의 실행이 완료된 상태
    이렇게 정리했습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants