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
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment Construction
[0030] Store two global variables in the shared memory, one is a spin lock variable, and the other is a variable used to generate an ID value, we call it an ID variable. All threads that want to use this spin lock need to access these two variables, and the two variables are initialized to 0 when the system is initialized.
[0031] The steps of locking a spin lock are as follows:
[0032] Step 101, the thread obtains the ID value from the ID variable. The ID value generation method is as follows: use the atomic operation to read the value in the ID variable and add 1 to its value. Since the read value operation and the add 1 operation are atomic, the same ID value will not be obtained when multiple threads access this ID variable within a similar time.
[0033] Step 102, the ID value obtained in step 101 and the state value after locking are synthesized into a spin lock variable value. When it is necessary to determine whether deadlock occurs during the locking process, foll...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com