Read-write balanced blocking queue implementation method and device

A technology for blocking queues and implementation methods, applied in the direction of multi-programming devices, etc., can solve the problems of increased investment in software economic costs, increased data synchronization security pressure, etc., to achieve the effect of removing risks, improving stability, and simplifying calling logic

Active Publication Date: 2014-08-06
FENGHUO COMM SCI & TECH CO LTD
View PDF3 Cites 5 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] At present, the most commonly used method in the industry is to relieve the pressure of service software processing by adding servers and deploying distributed clusters. This so

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 balanced blocking queue implementation method and device
  • Read-write balanced blocking queue implementation method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0035] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0036] An embodiment of the present invention provides a method for implementing a blocking queue for read-write balance, including the following steps:

[0037] A. see figure 1 As shown, add data to the synchronous blocking queue:

[0038] Step 101, the program adds N pieces of data to the synchronous blocking queue, where N is a positive integer;

[0039] Step 102, in the case of multi-threading, in order to ensure the integrity and correctness of the data, try to acquire the synchronization lock of the queue;

[0040] Step 103: After acquiring the synchronization lock of the queue, before adding data to the synchronous blocking queue, it is necessary to determine whether the synchronous blocking queue can add N pieces of data. If the queue exceeds the maximum setting range after adding N pieces of data, the program will run abnor...

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 read-write balanced blocking queue implementation method and device, and relates to the field of computer software programming. The method comprises the following steps that N data are added to a queue, and a synchronous lock of the queue is tried to obtain; whether the N data can be added to a synchronous blocking queue or not is determined, and wait is continued if the queue exceeds the maximum setting range after the N data are added until the queue allows N records to be added; the queue throws exception if the N exceeds the maximal length of the queue; after the N data are added to the synchronous blocking queue, the procedure of data adding is completed, and the synchronous lock of the queue is released; addition is continued or given up to complete the procedure of the addition; continuous addition is given up, and the addition procedure is finished. According to the read-write balanced blocking queue implementation method and device, sudden, non-continuous and non-quantitative large scale data processing pressure can be released effectively, the call logic of data queue can be simplified, risks of multithreading polling data are removed, and the stability of application programs for processing sudden large data volumes is improved.

Description

technical field [0001] The invention relates to the field of computer software programming, in particular to a method and device for realizing a read-write balanced blocking queue. Background technique [0002] With the development of the software industry, more and more software systems with large data volume and high concurrency are produced. With the increase of data volume, more and more performance pressures are approaching. What about more efficient and smoother processing of software system data? [0003] At present, the most commonly used method in the industry is to relieve the pressure of service software processing by adding servers and deploying distributed clusters. This solves the problem from the hardware level, but the economic cost of software has increased significantly, and the data after adding clusters The synchronization security pressure is also relatively increased. How to handle as many things as possible with limited resources and ensure that the ...

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/46
Inventor 刘言军
Owner FENGHUO COMM SCI & 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