Method for implementing spin lock in database

An implementation method and a technology of spin locks, which are applied in the database field, can solve problems such as locking deadlocks and spin locks that cannot adapt to application scenarios, and achieve the goals of avoiding deadlocks, improving the deadlock judgment process, and improving the locking process Effect
CN102129391AInactive Publication Date: 2011-07-20HUAZHONG UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN ยท China
Current Assignee / Owner
HUAZHONG UNIV OF SCI & TECH
Publication Date
2011-07-20
Estimated Expiration
Not applicable ยท inactive patent

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention discloses a method for implementing a spin lock in a database. The method for implementing the spin lock in the database is characterized by comprising the following steps of: storing two global variables, namely a spin lock variable and an ID variable in a shared memory, and initializing the two variables as 0 when a system is initialized; and memorizing a current spin lock holdingthread by using a high storage value of spin lock variables, and implementing automatic unlocking of the spin lock according to the storage value when the lock holding thread is abnormal and exits tocause deadlock. By the method, possible deadlock when multiple tasks compete with the same spin lock is avoided, and the spin lock can protect the operation on a data structure for a long time and can process the deadlock problem caused by the abnormal end of a locking thread in the period by changing a locking flow and a deadlock judgment flow.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention relates to the technical field of databases, in particular to an improved implementation method for spin locks in the concurrency control process. Background technique

[0002] In lock-based transaction concurrency control technology, databases often use spin locks to protect data structures and operations on them. The spin lock overhead is extremely small, but the spin lock can only protect light access to the data structure. During the spin lock protection period, there cannot be system calls or system interruptions. The protection time is very short, generally only for dozens of processors cycle. Because the principle of the spin lock is simple, the solution to the deadlock is also very simple. Usually, a timer with a fixed duration is used to time the task. Once the timing of the task is up, the subsequent task will be automatically unlocked directly. It is precisely because of this principle that when there are multiple tasks compe...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More