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

Active Publication Date: 2015-09-23
XFUSION DIGITAL TECH CO LTD
View PDF5 Cites 7 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] However, in the above method of acquiring the spin lock, no matter whether it is its turn to acquire the spin lock or not, the tasks in the linked list will periodically try to acquire the spin lock. As the number of tasks in the linked list increases, the This results in more requests to acquire spin locks and increases the performance loss of the system

Method used

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
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Spin lock acquisition method and apparatus
  • Spin lock acquisition method and apparatus
  • Spin lock acquisition method and apparatus

Examples

Experimental program
Comparison scheme
Effect test

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...

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

PUM

No PUM Login to view more

Abstract

An embodiment of the present invention provides a spin lock acquisition method and apparatus and relates to the technical field of computers. The performance loss of a system caused by the fact that a plurality of tasks competes for shared resources can be reduced, thereby improving the system performance. The method can comprise: receiving a task that requests for acquiring a spin lock; storing the task in a queuing queue; according to a position of the task in the queuing queue, determining spin waiting time of the task so that the task tries to acquire the spin lock at the end of the spin waiting time, wherein the position of the task in the queuing queue is used for characterizing a sequence of the task stored into the queuing queue and the position of task that is firstly stored into the queuing queue is in front of the position of the task that is later stored into the queuing queue.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a method and device for acquiring a spin lock. Background technique [0002] With the development of CPU multi-core and parallel technology, in the multi-node large-scale NUMA (Non Uniform Memory Access Architecture, non-uniform memory access) system using NC (Node Controller, node controller), in order to ensure the consistency of shared resources, usually Use the spinlock mechanism to control the concurrent operations of multiple transactions. [0003] In the prior art, the server can form a linked list of multiple tasks that apply for the spin lock, and store the same local variable protected by the spin lock in the cache of the processor where the multiple tasks are located. Therefore, the server may instruct the multiple tasks to periodically try to acquire the spin lock according to a preset time interval, so as to access the local variable. [0004] However, in the abo...

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

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/46
Inventor 张文涛徐彩虹赵家伟
Owner XFUSION DIGITAL TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products