Method and device for reading data

A technology for reading data and data packets, applied in the computer field, can solve the problems of data overflow and low data reading efficiency, and achieve the effect of reducing the number of times, reducing the probability of data overflow, and reducing the number of times.

Active Publication Date: 2012-04-04
TENCENT TECH (SHENZHEN) CO LTD +1
View PDF8 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] When reading data in the prior art, only one data packet is read at a time, and each time a data packet is read, the position of the head pointer in the channel will be modified, resulting in low efficiency of reading data; in addition, when reading data When the speed of the packet is lower than the speed of generating data packets, there will be more and more data packets in the channel, which will eventually lead to data overflow in the channel

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 reading data
  • Method and device for reading data
  • Method and device for reading data

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0034] see figure 1 , this embodiment provides a method for reading data, the method flow is as follows:

[0035] 101: Determine the head pointer position and the tail pointer position of the channel;

[0036] 102: Compare the height of the head pointer position and the tail pointer position;

[0037] 103: Continuously read data packets according to the comparison result.

[0038] Among them, the data packets are read continuously according to the comparison result, specifically including:

[0039] When it is compared that the position of the head pointer is higher than the position of the tail pointer, the data packet is read from the position of the head pointer until the end of the channel.

[0040] Further, the data packet is read from the position of the header pointer to the end of the channel, including:

[0041] Change the position of the head pointer, and read the data packet from the changed head pointer position to the tail pointer position.

[0042] Optionally...

Embodiment 2

[0046] This embodiment provides a method for reading data. The method reduces the number of times of reading data by continuously reading data, especially for reducing the speed of data in the channel when the speed of processing data packets is lower than the speed of generating data packets. probability of overflow. see figure 2 , the method flow provided by this embodiment is specifically as follows:

[0047] 201: Determine the position of the head pointer and the tail pointer of the channel;

[0048] For this step, the channel has a head pointer and a tail pointer. Every time a data packet is added in the channel, a fixed format STX(0x02)+channel auxiliary information+original data packet+ETX(0x03 ), and after storing the increased data packet in the channel, change the position of the tail pointer at the same time to make it point to the latest data position. Each data packet is continuous in physical position. The position of the head pointer and tail pointer of the ...

Embodiment 3

[0058] see Figure 5 , the present embodiment provides a device for reading data, the device comprising:

[0059] A determining module 501, configured to determine the position of the head pointer and the position of the tail pointer of the channel;

[0060] The comparison module 502 is used to compare the height of the head pointer position determined by the determination module 501 and the tail pointer position;

[0061] The reading module 503 is configured to continuously read data packets according to the comparison result of the comparison module 502 .

[0062] Wherein, the reading module 503 is specifically configured to read the data packet from the position of the head pointer to the end of the channel when the comparison module 502 compares that the position of the head pointer is higher than the position of the tail pointer.

[0063] Further, the reading module 503 is also used to read the data packet from the head pointer position until the end of the channel, cha...

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 device for reading data, which belong to the technical field of computers. The method comprises the following steps: determining a head-pointer position and a tail-pointer position of a channel; comparing the height of the head-pointer position and the height of the tail-pointer position; and sequentially reading a data packet according to a comparison result. The device comprises a determining module, a comparing module and a reading module. According to the invention, through sequentially reading the data packet, the times for reading the data can be reduced; and in addition, since the times for reading the data is reduced, the efficiency for reading the data can be improved, and thus the probability that data overflow from the channel is reduced.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a method and device for reading data. Background technique [0002] With the increasing amount of information, data storage and reading has become a common technical means for processing information. Each data unit in a channel (channel) storing data may be of fixed length, or may be of variable length in order to save space, that is, the length of each data unit is different. [0003] Regardless of whether the data unit in the channel is fixed-length or variable-length, when the existing technology reads data, it will read a data packet from the position of the head pointer in the channel, then decode the original data packet, and modify the head pointer , that is, read a data packet of a data unit each time and process it; when the amount of data is large, it is necessary to continuously scan the position of the head pointer in the channel until the position of the head poin...

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): G06F12/02
Inventor 袁清
Owner TENCENT TECH (SHENZHEN) 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