Java의 synchronized 키워드는 어떻게 작동하나요? #84
Sung-june27
started this conversation in
Concurrency
Replies: 3 comments
|
synchronized 키워드는 객체 또는 클래스에 대한 모니터 락을 획득해 임계 구역에 하나의 스레드만 접근하도록 보장하는 동기화 기술입니다. 모니터는 각 객체 혹은 클래스 단위로 존재하기 때문에 |
0 replies
|
synchronized는 내부적으로 모니터락을 이용해 동시성 문제를 방지합니다. synchronized영역을 만나게 되면 모니터락을 획득하고, wait() 으로 락을 내려놓고 큐에서 기다린다던가 notify()를 통해 큐에 있는 아무 스레드를 하나깨울 수 있습니다. |
0 replies
|
Java의 syncronized는 모든 객체가 기본적으로 보유한 모니터 락을 이용해 상호 배제를 구현합니다. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
.
All reactions