Method for implementing spin lock in database
An implementation method and spin lock technology, applied in the database field, can solve problems such as locking deadlock, spin lock cannot adapt to application scenarios, etc., to avoid deadlock situation, improve deadlock judgment process, and improve locking process. Effect
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment Construction
[0031] 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.
[0032] The steps of locking a spin lock are as follows:
[0033] Step 101, the thread obtains the ID value from the ID variable. The ID value generation method is as follows: read the value in the ID variable with an atomic operation, and add 1 to the ID variable. 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.
[0034] Step 102: Combine the ID value obtained in step 101 and the spinlock variable value after the spinlock is locked into a first variable value N. When it is necessary to determine whether a deadlock occurs during t...
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