Spin lock acquisition method and apparatus
A spin lock and task technology, applied in the computer field, can solve the problems of increasing system performance loss and obtaining too many spin locks
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0046] The embodiment of the present invention provides a method for obtaining a spin lock, such as figure 1 As shown, the method may include:
[0047] S101. The server receives a task requesting to acquire a spin lock.
[0048] Exemplarily, if a certain task needs to access a shared resource protected by a spin lock, the task needs to request the server to obtain the spin lock, and the server can first receive the task.
[0049]It should be noted that a spin lock is a lock introduced to prevent multiprocessor concurrency, which is widely used in interrupt processing and other parts in the kernel (for a single processor, to prevent concurrency in interrupt processing can be simply adopted The way to turn off interrupts, no spin lock is required). At any time, the spin lock can only be held by one task at most. If a task tries to acquire a spin lock that is already held by another task, the server can instruct the task to retry according to its spin waiting time. Acquire the...
Embodiment 2
[0062] The embodiment of the present invention provides a method for obtaining a spin lock, such as figure 2 As shown, the method may include:
[0063] S201. The server receives a task requesting to acquire a spin lock.
[0064] Exemplarily, if a certain task needs to access a shared resource protected by a spin lock, the task needs to request the server to obtain the spin lock, and the server can first receive the task.
[0065] It should be noted that a spin lock is a lock introduced to prevent multiprocessor concurrency, which is widely used in interrupt processing and other parts in the kernel (for a single processor, to prevent concurrency in interrupt processing can be simply adopted The way to turn off interrupts, no spin lock is required). At any time, the spin lock can only be held by one task at most. If a task tries to acquire a spin lock that is already held by another task, the server can instruct the task to retry according to its spin waiting time. Acquire t...
Embodiment 3
[0097] Such as image 3 As shown, the embodiment of the present invention provides a server 1, the server 1 may include:
[0098] The receiving unit 10 is configured to receive a task requesting to acquire a spin lock.
[0099] a saving unit 11, configured to save the task received by the receiving unit 10 in a queuing queue;
[0100] The determining unit 12 is configured to determine the spin waiting time of the task according to the position of the task saved in the queuing queue by the saving unit 11, so that when the spin waiting time of the task ends, the task , trying to acquire the spin lock, wherein the position of the task in the queuing queue is used to represent the order in which the tasks are saved in the queuing queue, and the tasks saved in the queuing queue first The position after is saved to the position of the task in the enqueuing queue.
[0101] optional, such as Figure 4 As shown, the server 1 further includes a detection unit 13, configured to perio...
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