Read-write lock implement method

An implementation method, a technology of read-write lock, applied in the information field, can solve the problems of reducing system efficiency, large kernel mode and user mode switching overhead, no distinction between concurrent read and write requests, etc., to achieve the effect of convenient integration and improved performance

Active Publication Date: 2013-03-27
INST OF SOFTWARE - CHINESE ACAD OF SCI
View PDF3 Cites 33 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

In this case, it is inappropriate to use mutexes, semaphores, events, etc. directly. On the one hand, there is a large switching overhead between the kernel state and the user state, and on the other hand, there is no distinction between concurrent read and write requests, resulting in possible Concurrently executed read-only requests become serially executed, greatly reducing system efficiency

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
  • Read-write lock implement method
  • Read-write lock implement method
  • Read-write lock implement method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0045] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. It should be understood that the described embodiments are only some of the embodiments of the present invention, not all of them. example. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts belong to the protection scope of the present invention.

[0046] Such as Figure 5 Shown is a flow diagram of the implementation method of the read-write lock of the present invention. The read-write lock solution mainly involves three parts. The read-write lock is applied in parallel and processed in parallel: 1) the initialization process of the read-write lock; 2) applying for and releasing the read-write lock ;3) Apply for and release the write lock.

[0047] Read-write lock component...

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 relates to a method for implementing synchronization among threads through a read-write lock. The method comprises the steps of: (1) initializing the read-write lock, initializing a read critical section and a write critical section to be at an enterable state and initializing a write notification event to be at a triggered state; (2) protecting critical codes in a shared resource according to the critical sections when a plurality of read threads and / or write threads concurrently access the shared resource, and setting the read-write lock; and (3) returning read-write lock information, and finishing the read-write lock setting to realize resource sharing. The method provided by the invention can implement the read-write lock by using the combination of the critical sections and the events, and has the advantages of being simple and easy to operate, light in load and high in speed. Meanwhile, the method can avoid the cost on frequently switching user states when a kernel mode object is used as the critical sections are taken as a main mutex tool; and the write threads do not need to wait infinitely and can access the shared resource after all of the read threads complete the operations when the lock write is applied, so as to prevent the condition that subsequent threads used for applying the read lock from occupies the shared resource, thereby greatly improving the performance of the read-write lock.

Description

technical field [0001] The invention relates to a read-write lock implementation method, in particular to a synchronization method between threads based on a read-write lock, which can be applied to the technical field of software development of various software system research and development, and belongs to the field of information technology Background technique [0002] In the field of information technology, software development involves many technologies, including memory data organization and management, message communication, index technology, synchronization and mutual exclusion technology, etc. The present invention focuses on the synchronization technology between threads in software development. In some specific software systems The research and development process involves synchronization technology between threads, and has high real-time and high-efficiency requirements for synchronization operations, such as: real-time database management systems, relational da...

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 INST OF SOFTWARE - CHINESE ACAD OF SCI
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