|
![]() ![]()
|
The Lock subsystem is useful outside the context of Berkeley DB. It can be used to manage concurrent access to any collection of either ephemeral or persistent objects. That is, the lock region can persist across invocations of an application, so it can be used to provide long-term locking (for example, conference room scheduling).
(락서브시스템은 버클리디비외에도 유용하게 사용된다.이것은 어떤 오브젝트에 대한 동시성제어를 관리할 수 있다.즉 락구역은 애플리케이션 호출에 대해 지속적으로 관리될 수 잇다. 그리고 이것은 긴기간의 락킹(예,회의실 스케쥴링)을 제공하기 위해 사용될 수 있다.)
In order to use the locking subsystem in such a general way, the applications must adhere to a convention for identifying objects and lockers. Consider a conference room scheduling problem, in which there are three conference rooms scheduled in half-hour intervals. The scheduling application must then select a way to identify each conference room/time slot combination. In this case, we could describe the objects being locked as bytestrings consisting of the conference room name, the date when it is needed, and the beginning of the appropriate half-hour slot.
(일반적 방식으로 락서브시스템을 사용하기 위해서는 애플리케이션은 오브젝트와 락구분을 위한 컨벤션을 지켜야 한다.30분 간격으로 3개의 회의실 스케쥴링 문제를 생각할때 스케쥴링 애플리케이션은 각 회의실/타임 슬롯 조합을 구별하는 방법을 선택해야 한다. 이경우에 우리는 회의실이름,필요한 날짜,적절한 30분단위의 슬롯으로 구성된 바이트스트링으로 락되는 오브젝트를 묘사할 수 있다.)
Lockers are 32-bit numbers, so we might choose to use the User ID of the individual running the scheduling program. To schedule half-hour slots, all the application needs to do is issue a DB_ENV->lock_get call for the appropriate locker/object pair. To schedule a longer slot, the application needs to issue a DB_ENV->lock_vec call, with one DB_ENV->lock_get operation per half-hour -- up to the total length. If the DB_ENV->lock_vec call fails, the application would have to release the parts of the time slot that were obtained.
(락커는 32비트 숫자다.그래서 우리는 스케쥴링 프로그램을 실해하는 사용자 의 사용자ID를 락커로 사용할 수 있다.30분단위 슬롯을 스케쥴링하기 위해 애플리케이션은 적절한 락커/오브젝트 쌍에 대해 DB_ENV->lock_get 를 호출하기만 하면 된다.더긴슬롯을 스케쥴링하기위해서는 애플리케이션은 DB_ENV->lock_vec을 30분단위의 DB_ENV->lock_get과 함께 전체길이에 이를때까지 발생시켜야 한다.만약 DB_ENV->lock_vec 이 실패하면 애플리케이션은 얻었던 타입슬롯 부분을 릴리즈해야 한다.)
To cancel a reservation, the application would make the appropriate DB_ENV->lock_put calls. To reschedule a reservation, the DB_ENV->lock_get and DB_ENV->lock_put calls could all be made inside of a single DB_ENV->lock_vec call. The output of DB_ENV->lock_stat could be post-processed into a human-readable schedule of conference room use.
(회의실 예약을 취소하기 위해서 애플리케이션은 적절한 DB_ENV->lock_put 을 호출해야 한다.예약을 다시 스캐쥴링하기 위해서 단일 DB_ENV->lock_vec 안에서 DB_ENV->lock_get and DB_ENV->lock_put이 호출될수 있다. DB_ENV->lock_stat 의 출력값은 사람이 읽을수 있는 형태로 처리하여 변형될 수 있다.)
![]() ![]()
|
Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.