Method, device and equipment for realizing spin lock during resource access

A resource access and implementation method technology, applied in the computer field, can solve problems such as wasting system resources and excessive consumption of the central processing unit

Pending Publication Date: 2020-11-24
上海金仕达软件科技股份有限公司
View PDF0 Cites 3 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The embodiment of the present application provides a method, device and equipment for implementing spin locks during resource access, which can solve the problem that the exi

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
  • Method, device and equipment for realizing spin lock during resource access
  • Method, device and equipment for realizing spin lock during resource access
  • Method, device and equipment for realizing spin lock during resource access

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0045] In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

[0046] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude one or more other Presence or addition of features, wholes, steps, operations, elements, components and / or collections thereof.

[0047] It should...

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

The invention is applicable to the technical field of computers, and provides a method for realizing a spin lock during resource access, which comprises the following steps of obtaining a resource access request, and locking the spin lock corresponding to a target resource according to an identifier of the target resource; if the spin lock fails to be locked and the cycle index is smaller than a preset cycle threshold, adding 1 to the cycle index, and returning to lock the spin lock corresponding to the target resource according to the identifier of the target resource; and if the spin lock issuccessfully locked, executing an access operation corresponding to the resource access request on the target resource. According to the scheme, a preset cycle threshold is set, if the spin lock fails to be locked and the cycle index is smaller than a preset cycle threshold 1 is added to the cycle index, and the steps of locking the spin lock corresponding to the target resource is returned to execute according to the identifier of the target resource, firstly the spin lock is spinned for a certain number of times, lock is tried to be obtained, and the lock is stopped being acquired again ifthe spinning exceeds a certain number of times, so that the situation that the spin lock always waits for spinning to cause resource competition of the central processing unit is avoided.

Description

technical field [0001] The present application belongs to the technical field of computers, and in particular relates to a method, device and equipment for realizing a spin lock during resource access. Background technique [0002] When accessing resources, in order to ensure the consistency of shared resources, resource locks are usually used to control multiple threads or processes. When the scope of the critical section is relatively large, the probability of conflict in accessing the shared resources in the critical section will be relatively high, and the waiting time for acquiring the lock will be relatively long. In this case, a mutex lock can be used. When the scope of the critical section is relatively small, the probability of conflict between threads accessing the shared resources in the critical section is relatively small, and the waiting time for acquiring the lock will be relatively short. In this case, a spin lock can be used. [0003] However, when the scop...

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
IPC IPC(8): G06F9/52G06F9/50
CPCG06F9/5027G06F9/524G06F9/526
Inventor 朱鸿斌宫耀东夏之春左若愚刘艳云
Owner 上海金仕达软件科技股份有限公司
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