Skip to content

Commit

Permalink
Update Concurrency Control Mechanisms 7905a96a94f94aa2844ac41618bbc85…
Browse files Browse the repository at this point in the history
…8.md
  • Loading branch information
483759 authored Nov 22, 2021
1 parent af2a14b commit 46e8867
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

# Database Lock ❓

![Untitled](Concurrency%20Control%20Mechanisms%207905a96a94f94aa2844ac41618bbc858/Untitled.png)
![Untitled](https://user-images.githubusercontent.com/30489264/142808253-8ed178bf-fabd-460d-9bbe-c70e56bdee78.png)

RDBMS에서 트랜잭션 시스템에 적용되는 동시성 제어 방법.

특정 트랜잭션이 레코드에 접근 중 일때 다른 트랜잭션이 해당 데이터에 접근하지 못 하게 막는 것을 의미한다. 일반적으로 Lock의 단위가 너무 작으면 독립성이 보장받지 못 하고, 너무 크면 트랜잭션이 직렬화 되어 수행 시간이 느려진다.

# Optimistic Concurrency Control

![Untitled](Concurrency%20Control%20Mechanisms%207905a96a94f94aa2844ac41618bbc858/Untitled%201.png)
![Untitled 1](https://user-images.githubusercontent.com/30489264/142808274-788b5832-61a0-4c69-ae2c-3a913c15be82.png)

여러 트랜잭션이 **서로 간섭하지 않고 자주 완료될 수 있다**고 가정하는 동시성 제어 방식.

Expand Down Expand Up @@ -77,7 +77,7 @@ JPA에서는 `@Version` 어노테이션을 이용해서 낙관적 락을 사용

# Pessimistic Concurrency Control

![Untitled](Concurrency%20Control%20Mechanisms%207905a96a94f94aa2844ac41618bbc858/Untitled%202.png)
![Untitled 2](https://user-images.githubusercontent.com/30489264/142808297-5b05b622-c728-43c9-8501-0114246af8f8.png)

여러 트랜잭션이 자주 간섭된다고 가정하는 동시성 제어 방식.

Expand All @@ -91,4 +91,4 @@ OCC에 비해 높은 무결성을 가지고 있지만, 교착 상태가 발생

### Exclusive Lock

배타락은 수정/삭제를 할 때 거는 락의 종류이다. 배타락을 걸게 되면 다른 트랜잭션은 그 데이터에 읽기/수정/삭제 연산을 할 수 없고, 어떠한 락도 걸 수 없다.
배타락은 수정/삭제를 할 때 거는 락의 종류이다. 배타락을 걸게 되면 다른 트랜잭션은 그 데이터에 읽기/수정/삭제 연산을 할 수 없고, 어떠한 락도 걸 수 없다.

0 comments on commit 46e8867

Please sign in to comment.