Method and device for implementing a read-write lock

An implementation method, a technology of read-write lock, which is applied in the field of communication and can solve problems such as unfairness

Active Publication Date: 2019-11-19
SUZHOU YUDESHUI ELECTRIC TECH CO LTD
View PDF10 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The embodiment of the present invention provides a method and device for implementing a read-write lock, which is used to solve the technical problem of unfairness that may be caused by adopting a distributed method in the prior art

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 and device for implementing a read-write lock
  • Method and device for implementing a read-write lock
  • Method and device for implementing a read-write lock

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0060] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only some of the embodiments of the present invention, rather than all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

[0061] Read-write lock is the most commonly used competition mechanism for critical resources in multi-core systems. Critical resources refer to resources that only allow one writer or reader to operate at a time, or only one writer is allowed to write at a time and multiple readers are allowed Resources for read operations, writers and readers refer to hardware or software that needs to perform specified operations on critical resources...

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 embodiment of the invention discloses a realization method and device of a reading-writing lock. A set of reading-writing locks in the embodiment comprises a writing public lock and N reading private locks which correspond to the writing public lock; the realization method comprises the steps of, after determining that the writing public lock is unlocked, setting the writing public lock into a locking state if a writing lock application exists; determining that each reading private lock is in an unlocking state, distributing the writing public lock to a writing lock application with highest writing priority; and if the writing lock application does not exist, distributing a corresponding reading private lock for the reading lock application. In the embodiment, the reading lock applications respectively have corresponding reading private locks, so that concurrence of the reading lock applications is realized and the problem of sharply decreased reading-writing performance caused by operating the same shared memory frequently by multiple readers in the prior art can be avoided; in addition, the writing public lock is set into the locking state, so that readers corresponding to the reading lock application in a reading waiting queue cannot obtain the reading private locks, and fairness among the readers is realized.

Description

technical field [0001] The invention relates to the field of communication technology, in particular to a method and device for realizing a read-write lock. Background technique [0002] Read-write lock is a basic mechanism to achieve data mutual exclusion. Currently, you can configure the read-write lock to be read-first or write-first. If the read-write lock is configured to be read-first, if there is a write lock application waiting for the lock, it will not Will block the read lock application. If the read-write lock is configured with write priority, if there is a write lock application waiting for the lock, all subsequent read lock applications will be blocked. [0003] For multi-core systems, the implementation process of a distributed read-write lock is as follows: configure a read-write lock for each core in the multi-core system, each core as a reader can only read the read-write lock of the core, and as a writer The cores acquire the read-write locks of the rema...

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 Patents(China)
IPC IPC(8): G06F3/06
CPCG06F3/0604G06F3/061G06F3/0637
Inventor 吴轩朱家法徐永新
Owner SUZHOU YUDESHUI ELECTRIC 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