lock을 사용할때는 해당 작업에서 사용할 모든 tables에 lock을 걸어야한다. 그렇지 않으면 lock 상태에서 lock이 걸리지 않은 table에 접근하지 못한다.
* Read lock
다른 threads 뿐만 아니라 심지어 lock을 설정한 thread 조차도 table을 update 할 수 없다. 모든 threads는 오직 read만 할 수 있다.
* Write lock
lock을 설정한 thread만 table에 update를 할 수 있다. lock을 설정한 thread가 해당 table에 update를 하기 전에는 다른 threads가 read는 할 수 있지만, 한번 update가 발생해서 change된 row가 있으면 그 후부터는 다른 threads는 해당 table에 read도 할 수 없게 된다.

comments
comments rss (+댓글 쓰러가기)