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

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

Example Embodiment

[0033] Example 1

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

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

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

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

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

[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 head pointer position until after the end of the channel, including:

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

Example Embodiment

[0045] Embodiment 2

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

[0047] 201: Determine the position of the head pointer and the position of 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) will be printed on each data packet. ), and at the same time change the tail pointer position to point to the latest data position after storing the added data packet in the channel. Each data packet is continuous in physical position. The positi...

Example Embodiment

[0057] Embodiment 3

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

[0059] A determination module 501 is used to determine the head pointer position and the tail pointer position of the channel;

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

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

[0062] The reading module 503 is specifically configured to read the data packet from the head pointer position 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 start reading the data packet from the position of the head pointer, until after the end of the 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