Thread lock optimization method

An optimization method and thread lock technology, applied in the computer field, can solve problems such as low performance, low theoretical and technical requirements, etc., and achieve the effects of performance improvement, security, and occupancy reduction

Inactive Publication Date: 2016-09-28
BEIJING INTELLIGENT STEWARD CO LTD
View PDF3 Cites 12 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The purpose of the present invention is to provide an optimization method for thread locks, realize a general non-blocking lock structure, and efficiently realize safe sharing of data between threads, so as to solve the problems caused by the use of mutex locks in large-scale concurrent systems in the prior art The problem of low performance and 100% CPU occupancy of the CAS scheme, while maintaining the same generality as the POSIX mutex, lowers the theoretical and technical requirements for the correct use of the caller

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
  • Thread lock optimization method
  • Thread lock optimization method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0019] The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0020] The optimization method of thread lock of the present invention comprises the following steps:

[0021] Determine the critical section (CS, critical section) in memory;

[0022] Using the synchronization primitives provided by the CPU, the control thread lock is responsible for protecting the key section. Before a thread enters the key section, it needs to obtain the access right of the thread lock to ensure that only one thread can enter the CS at the same time.

[0023] The key segment is a memory space storing shared variables, and the determination of the key segment can be specified by those skilled in the art (or users) according to actual needs. The purpose of the present invention is to utilize the synchronization primitives provided by some CPUs to realize atomic access (atomic access) to a shared variable, that is, to...

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 present invention provides a thread lock optimization method. The method comprises the following steps: determining a key section in a memory; and using a synchronization primitive provided by the CPU, controlling a thread lock to take charge of protecting the key section, before a thread enters the key section, allowing to obtain the access right of the thread lock firstly, and ensuring that at the same time only one thread can enter the key section. The key section is a memory space stored with shared variables, and the determination of the key section is designated by a user. According to the thread lock optimization method disclosed by the present invention, the synchronization expense between the common lock threads in the original universal system is avoided, only a small number of CPU primitives is used, safety between threads is realized, the rate is increased by a hundred times, and performance of synchronous parallel access to the same locked area is improved by at least a hundred times, so that the performance is significantly enhanced, the CPU occupancy rate is significantly reduced, and the conflict between the threads is reduced.

Description

technical field [0001] The invention relates to the technical field of computers, in particular to a thread lock optimization method. Background technique [0002] In the prior art, relying on the threading model provided by the operating system, such as POSIX (Portable Operating System Interface) thread locks, mutual exclusion between threads can access the same memory object, so as to achieve the purpose of safely sharing data between threads. [0003] However, POSIX thread mutexes or POSXI-compatible thread mutexes are implemented through operating system callbacks. Since system callbacks need to switch between user space and operating system kernel space multiple times, POSIX thread mutexes are a kind of Heavy lock structure. In a large-scale concurrent system, implementing thread safety requires the use of a large number of mutexes, which are also an operating system resource. In a large-scale concurrent system, frequent calls to mutex locks cause frequent switching b...

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/52
CPCG06F9/526
Inventor 王桂杰
Owner BEIJING INTELLIGENT STEWARD 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