Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method and system for optimizing reader-writer lock based on Linux

An optimization method, a technology of read-write locks, applied in the direction of input/output to record carriers, etc., can solve the problems of starvation of readers, starvation of readers and writers, and starvation of writers, so as to improve resource utilization and system parallel processing. performance, the effect of avoiding starvation

Active Publication Date: 2016-01-06
INSPUR BEIJING ELECTRONICS INFORMATION IND
View PDF5 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, both of these two configuration methods will cause readers or writers to starve to death. When the configuration is reader-first, the writer will starve to death, and when the configuration is writer-first, the reader will starve to death.

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 system for optimizing reader-writer lock based on Linux
  • Method and system for optimizing reader-writer lock based on Linux

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0048] In order to facilitate the understanding of those skilled in the art, the present invention will be further described below in conjunction with the accompanying drawings, which cannot be used to limit the protection scope of the present invention.

[0049] This paper takes Linux kernel 2.6.32 as an example, fully considers the situation of readers and writers, and proposes an optimization method based on the priority of readers and writers to minimize or avoid the situation of readers or writers starving to death, and improve the system performance. Resource utilization and system parallel processing performance.

[0050] The optimization of the read-write spin lock in the present invention includes three parts: the optimization of adding a read lock, the optimization of adding a write lock, and the optimization of releasing a lock. The optimization method in this paper optimizes these three parts. The design idea of ​​the present invention is: based on the priority of ...

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 discloses a method and a system for optimizing reader-writer locks based on the Linux. The method comprises: receiving a reader lock adding application or a writer lock adding application, and determining whether reader-writer locks are in an applied state before; if the reader-writer locks are not in the applied state, directly processing the reader lock adding application or the writer lock adding application; if the reader-writer locks are in the applied state and are occupied, adding the reader lock adding application in a preset read-write waiting queue, and upgrading read highest priority-first or write highest priority-first recorded in a rwlock structural body; when the occupied reader-writer lock is released, determining whether reader-writer lock adding applications wait in the read-write waiting queue; according to a determination result, and the read highest priority-first and the write highest priority-first, processing the reader lock adding application in the read waiting queue and the writer lock adding application in the write waiting queue. Through the scheme, situation that a reader or a writer starves can be reduced or prevented, so as to improve resource utilization rate of the system and system parallel processing performance.

Description

technical field [0001] The invention relates to the field of operating system design, in particular to a Linux-based read-write lock optimization method and system. Background technique [0002] There are two basic mechanisms for data mutual exclusion under linux, including semaphores (Semaphore) and spin locks (Spinlock). Due to the nature of mutual exclusion, the code using spin locks has no thread concurrency at all, and the performance of multiprocessor systems is limited. Reader-Writer spinlock (Reader-WriterSpinlock) divides threads into readers and writers. Multiple readers can be allowed to access shared resources at the same time. Shared resources can only be accessed by one writer in a period of time. The application thread is in the waiting period. The busy waiting method is still used. [0003] Currently, Linux can configure the read-write lock to be read-first or write-first. The default read-write lock is read-first. If a writer is waiting for the lock, the r...

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): G06F3/06
Inventor 刘璧怡周恒钊
Owner INSPUR BEIJING ELECTRONICS INFORMATION IND
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products