CN109101438A - Method and apparatus for storing data - Google Patents

Method and apparatus for storing data Download PDF

Info

Publication number
CN109101438A
CN109101438A CN201810826491.3A CN201810826491A CN109101438A CN 109101438 A CN109101438 A CN 109101438A CN 201810826491 A CN201810826491 A CN 201810826491A CN 109101438 A CN109101438 A CN 109101438A
Authority
CN
China
Prior art keywords
node
data
pointer
idle
delete command
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810826491.3A
Other languages
Chinese (zh)
Other versions
CN109101438B (en
Inventor
杨笛
李涵
甘璐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201810826491.3A priority Critical patent/CN109101438B/en
Publication of CN109101438A publication Critical patent/CN109101438A/en
Application granted granted Critical
Publication of CN109101438B publication Critical patent/CN109101438B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/0292User address space allocation, e.g. contiguous or non contiguous base addressing using tables or multilevel address translation means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0646Configuration or reconfiguration
    • G06F12/0653Configuration or reconfiguration with centralised address assignment

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the present application discloses method and apparatus for storing data.One specific embodiment of the above method includes: to the continuous node pool of chained list storage allocation block address being pre-created;It is directed to the data insertion order of chained list in response to receiving, determine the insertion position of data insertion order instruction and obtains idle node from node pool;Write data into idle node;According to the idle node, the pointer of the previous node of insertion position, latter node and idle node is set.This embodiment, reduces the times needed for traversal chained list, improve the efficiency of traversal chained list.

Description

Method and apparatus for storing data
Technical field
The invention relates to field of computer technology, and in particular to method and apparatus for storing data.
Background technique
Chained list is storage organization discontinuous, non-sequential on a kind of physical memory cell, and the logical order of data element is It is realized by the pointer link orders in chained list.Using list structure can overcome array linked list need that data are known in advance it is big Small disadvantage, list structure can make full use of calculator memory space, realize that flexible memory dynamic manages.
Summary of the invention
The embodiment of the present application proposes method and apparatus for storing data.
In a first aspect, the embodiment of the present application provides a kind of method for storing data, comprising: to the chain being pre-created The continuous node pool of table storage allocation block address;It is directed to the data insertion order of above-mentioned chained list in response to receiving, determines above-mentioned The insertion position and obtain idle node from above-mentioned node pool that data insertion order indicates;Write data into above-mentioned idle section Point;According to above-mentioned idle node, the finger of the previous node of above-mentioned insertion position, latter node and above-mentioned idle node is set Needle.
In some embodiments, the above method further include: the above-mentioned chained list being pre-created of initialization.
In some embodiments, the above method further include: the data-delete command of above-mentioned chained list is directed in response to receiving, It determines the position of the node of above-mentioned data-delete command instruction and deletes and stored in the node that above-mentioned data-delete command indicates Data;Previous node, latter node and the above-mentioned data that the position of the node of above-mentioned data-delete command instruction is arranged are deleted Except the pointer of the node of order instruction.
In some embodiments, the above method further include: reset the node of above-mentioned data-delete command instruction;After resetting Node return to above-mentioned node pool.
In some embodiments, pointer includes prior pointer and backpointer;And it is above-mentioned according to above-mentioned idle node, in setting State the previous node of insertion position and the pointer of latter node and above-mentioned idle node, comprising: above-mentioned insertion position is set The backpointer of previous node is directed toward above-mentioned idle node;The prior pointer that the latter node of above-mentioned insertion position is arranged is directed toward above-mentioned sky Not busy node;The prior pointer that above-mentioned idle node is arranged is directed toward the previous node and the above-mentioned idle node of setting of above-mentioned insertion position Backpointer be directed toward the latter node of above-mentioned insertion position.
In some embodiments, pointer includes prior pointer and backpointer;And the above-mentioned above-mentioned data-delete command of setting refers to The pointer of the previous node of the position of the node shown and the node of latter node and above-mentioned data-delete command instruction, comprising: The backpointer that the previous node of the position of the node of above-mentioned data-delete command instruction is arranged is directed toward above-mentioned data-delete command and refers to The latter node of the position of the node shown;The preceding finger of the latter node of the position of the node of above-mentioned data-delete command instruction is set Needle is directed toward the previous node of the position of the node of above-mentioned data-delete command instruction;Delete the section of above-mentioned data-delete command instruction The prior pointer and backpointer of point.
Second aspect, the embodiment of the present application provide a kind of device for storing data, comprising: allocation unit is matched It is set to the continuous node pool of chained list storage allocation being pre-created;Acquiring unit is configured in response to receive for upper The data insertion order for stating chained list determines the insertion position of above-mentioned data insertion order instruction and obtains from above-mentioned node pool Idle node;Writing unit is configured to write data into above-mentioned idle node;First setting unit, is configured to according to upper Idle node is stated, the pointer of the previous node of above-mentioned insertion position, latter node and above-mentioned idle node is set.
In some embodiments, above-mentioned apparatus further include: initialization unit is configured to initialize above-mentioned be pre-created Chained list.
In some embodiments, above-mentioned apparatus further include: delete unit, be configured in response to receive for above-mentioned chain The data-delete command of table determines the position of the node of above-mentioned data-delete command instruction and deletes above-mentioned data-delete command The data stored in the node of instruction;Second setting unit is configured to be arranged the node of above-mentioned data-delete command instruction The pointer of the node of the previous node of position, latter node and the instruction of above-mentioned data-delete command.
In some embodiments, above-mentioned apparatus further include: reset cell is configured to reset above-mentioned data-delete command and refers to The node shown;Return unit, the node after being configured to reset return to above-mentioned node pool.
In some embodiments, pointer includes prior pointer and backpointer;And above-mentioned first setting unit is further matched Be set to: the backpointer that the previous node of above-mentioned insertion position is arranged is directed toward above-mentioned idle node;After above-mentioned insertion position is set The prior pointer of one node is directed toward above-mentioned idle node;The prior pointer that above-mentioned idle node is arranged is directed toward the previous of above-mentioned insertion position Node and the backpointer of the above-mentioned idle node of setting are directed toward the latter node of above-mentioned insertion position.
In some embodiments, pointer includes prior pointer and backpointer;And above-mentioned second setting unit is further matched Be set to: the backpointer that the previous node of the position of the node of above-mentioned data-delete command instruction is arranged is directed toward above-mentioned data and deletes life Enable the latter node of the position of the node of instruction;The latter node of the position of the node of above-mentioned data-delete command instruction is set Prior pointer is directed toward the previous node of the position of the node of above-mentioned data-delete command instruction;Delete above-mentioned data-delete command instruction Node prior pointer and backpointer.
The third aspect, the embodiment of the present application provide a kind of equipment, comprising: one or more processors;Storage device, On be stored with one or more programs, when said one or multiple programs are executed by said one or multiple processors so that on It states one or more processors and realizes the method as described in first aspect any embodiment.
Fourth aspect, the embodiment of the present application provide a kind of computer-readable medium, are stored thereon with computer program, should The method as described in first aspect any embodiment is realized when program is executed by processor.
The method and apparatus for storing data provided by the above embodiment of the application, first can be to being pre-created The continuous node pool of chained list storage allocation block address.Then when receiving the data insertion order to chained list, above-mentioned number is determined According to the insertion position of insertion order instruction, and idle node is obtained from node pool.Then, the acquired free time is write data into In node.Finally, according to above-mentioned idle node, the finger of the previous node of insertion position, latter node and idle node is set Needle.The method and apparatus of the present embodiment are assigned with the continuous node pool of block address memory for chained list, it is ensured that respectively save in chained list Relatively continuous, the time needed for reducing traversal chained list of the address of point, the efficiency of raising traversal chained list.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is the flow chart according to one embodiment of the method for storing data of the application;
Fig. 2 is the schematic diagram according to an application scenarios of the method for storing data of the application;
Fig. 3 is the flow chart according to another embodiment of the method for storing data of the application;
Fig. 4 is the structural schematic diagram according to one embodiment of the device for storing data of the application;
Fig. 5 is adapted for the structural schematic diagram for the computer system for realizing the equipment of the embodiment of the present application.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
It continues to refer to figure 1, shows the process of one embodiment of the method for storing data according to the application 100.The method for storing data of the present embodiment, comprising the following steps:
Step 101, to the continuous node pool of chained list storage allocation block address being pre-created.
In the present embodiment, it may include memory in the executing subject of method for storing data, and operation be installed System application.A chained list for storing data can be pre-created in executing subject, and above-mentioned chained list may include multiple Node, each of chained list element are known as node.It can also include head pointer and tail pointer in chained list.Head pointer is for determining The corresponding storage location of first element, i.e., the position of first node in chained list.Tail pointer is for determining last bit member in chained list The corresponding storage location of element, the i.e. position of the last one node.Executing subject can be into the above-mentioned chained list distribution being pre-created The continuous node pool of block addresses.Application program would generally use calculator memory can be upward in the present embodiment at runtime State chained list distribution node pond.It include multiple memory nodes in node pool, memory node refers to a memory block of particular size, interior Counterfoil is the basic unit of operating system operation memory.Each memory block is owned by address, and in the present embodiment, executing subject is to chain The address of each memory block in the node pool of table distribution is continuous.
In some optional implementations of the present embodiment, executing subject can also initialize the above-mentioned chain being pre-created Table.The length of chained list after initialization is zero, at this point, head pointer is sky, tail pointer is directed toward itself.
Step 102, it is directed to the data insertion order of chained list in response to receiving, determines the insertion of data insertion order instruction Position and idle node is obtained from node pool.
Executing subject can determine inserting for data insertion order instruction when receiving the data insertion order for chained list Enter position.Above-mentioned data insertion order can be what user generated for some operation of chained list, be also possible in executing subject The operating system of installation, which receives, to be generated after relevant information.Executing subject, can be with logarithm after receiving data insertion order It is parsed according to insertion order, determines the insertion position of data insertion order instruction.It is understood that in data insertion order It should include the position that the node where data to be stored should be inserted into.
Executing subject can also obtain idle node after receiving data insertion order from node pool.In this implementation In some optional implementations of example, when obtaining idle node, executing subject can successively be obtained according to the address of memory block Take memory block as idle node.In this way, the corresponding address of each node in chained list can be made relatively continuous, to reduce traversal Time needed for chained list.
Step 103, idle node is write data into.
Executing subject data to be stored can be written in above-mentioned idle node after getting idle node.For example, Executing subject can write data into idle node according to predetermined storage mode.
Step 104, according to idle node, the finger of the previous node of insertion position, latter node and idle node is set Needle.
In the present embodiment, each node in chained list in addition to head node and tail node may include 3 elements: forward direction refers to Needle prev, backwarding pointer next and data data.Head node and tail node only include two elements: forwarding pointer prev and backward Pointer next.Executing subject, can be according to idle node, the previous of insertion position is arranged after writing data into idle node The pointer of node, latter node and idle node.For example, executing subject can be arranged simultaneously previous node backwarding pointer, The forwarding pointer of latter node and the forwarding pointer of idle node and/or backwarding pointer.
In some optional implementations of the present embodiment, above-mentioned steps 104 can be by unshowned following in Fig. 1 Step is realized: firstly, the backpointer of the previous node of setting insertion position is directed toward idle node.Then, insertion position is set Latter node prior pointer be directed toward idle node.Finally, the prior pointer of setting idle node is directed toward the previous section of insertion position Point and the backpointer of setting idle node are directed toward the latter node of insertion position.
When the pointer of previous node of insertion position is arranged, the backwarding pointer that previous node can be set is directed toward idle section Point.Then the forwarding pointer of idle node is directed toward previous node, backwarding pointer is directed toward latter node.Before latter node Idle node is directed toward to pointer.
With continued reference to the signal that Fig. 2, Fig. 2 are according to the application scenarios of the method for storing data of the present embodiment Figure.In the application scenarios of Fig. 2, chained list includes multiple nodes, and 4 nodes of middle section are only schematically illustrated in figure, Respectively node 1, node 2, node 3 and node 4.It is connected with each other between each node by forwarding pointer and backwarding pointer.Node It include multiple idle nodes in pond, and the block address memory of above-mentioned each idle node is continuous.Executing subject is receiving data After insertion order, determine insertion position between node 2 and node 3.Meanwhile executing subject obtains idle section from node pool Point.After writing data into idle node, the finger of node 2, the forwarding pointer of node 3 and idle node and backwarding pointer is had adjusted To.Realize the storage of data.
The method for storing data provided by the above embodiment of the application, first can be to the chained list being pre-created point With the continuous node pool of block address memory.Then when receiving the data insertion order to chained list, above-mentioned data insertion is determined The insertion position of instruction is ordered, and obtains idle node from node pool.Then, acquired idle node is write data into In.Finally, according to above-mentioned idle node, the pointer of the previous node of insertion position, latter node and idle node is set.This The method of embodiment is assigned with the continuous node pool of block address memory for chained list, since the operating system in executing subject is each The memory address of the idle node obtained from node pool is relatively continuous, and operating system is mentioned when accessing above-mentioned chained list The probability of height hit caching.To accelerate the speed that operating system reads chained list, the time needed for reducing traversal chained list, mention The high efficiency of traversal chained list.
With continued reference to Fig. 3, it illustrates the streams according to another embodiment of the method for storing data of the application Journey 300.As shown in figure 3, the method for storing data of the present embodiment can also include the following steps:
Step 301, it is directed to the data-delete command of chained list in response to receiving, determines the node of data-delete command instruction Position and delete the data that store in the node of data-delete command instruction.
Executing subject can determine above-mentioned data-delete command when receiving the data-delete command for chained list first The position of the node of instruction.Above-mentioned data-delete command can be what user generated some operation of chained list, be also possible to hold The operating system installed in row main body, which receives, to be generated after relevant information.Executing subject after receiving data-delete command, Data-delete command can be parsed, determine the position of the node of data-delete command instruction.It is understood that data It should include the position of the node where data to be deleted in insertion order.
Step 302, the previous node and latter node and data of the position for the node that setting data-delete command indicates The pointer of the node of delete command instruction.
Executing subject after determining the position of node of data-delete command instruction, can previous node to the position, The pointer of latter node and the node of data-delete command instruction is configured.For example, executing subject can modify it is previous The direction of the backwarding pointer of node, latter node forwarding pointer direction.Executing subject can also delete data-delete command The forwarding pointer and backwarding pointer of the node of instruction.
In some optional implementations of the present embodiment, above-mentioned steps 302 specifically can be by unshowned in Fig. 3 Following steps are realized: firstly, the backpointer of the previous node of the position for the node that setting data-delete command indicates is directed toward number According to the latter node of the position of the node of delete command instruction.Then, the position for the node that setting data-delete command indicates The prior pointer of latter node is directed toward the previous node of the position of the node of data-delete command instruction.It is deleted finally, deleting data Order the prior pointer and backpointer of the node of instruction.
Step 303, the node of resetting data-delete command instruction.
In the present embodiment, the node that executing subject can indicate data-delete command is reset.In this way, the node can To be again written data.
Step 304, by the node return node pond after resetting.
Executing subject can be by the node return node pond after resetting, for chained list recycling.In this way, avoiding execution It is destructed that the operating system installed in main body calls destructor function to carry out above-mentioned node, effectively improves the effect of deletion of node Rate.Meanwhile the situation that the quantity that also avoids enabled node in node pool is fewer and fewer.
The method for storing data provided by the above embodiment of the application, after the node of deletion being reset, weight It newly is put into node pool, for utilizing again, reduces the operating time.
With further reference to Fig. 4, as the realization to method shown in above-mentioned each figure, this application provides one kind for storing number According to device one embodiment, the Installation practice is corresponding with embodiment of the method shown in FIG. 1, which can specifically answer For in various electronic equipments.
As shown in figure 4, the device 400 for storing data of the present embodiment includes: allocation unit 401, acquiring unit 402, writing unit 403 and the first setting unit 404.
Wherein, allocation unit 401 are configured to the continuous node pool of chained list storage allocation being pre-created.
Acquiring unit 402 is configured in response to receive the data insertion order for chained list, determines data insertion life It enables the insertion position of instruction and obtains idle node from node pool.
Writing unit 403 is configured to write data into idle node.
First setting unit 404 is configured to be arranged according to idle node previous node, the latter node of insertion position And the pointer of idle node.
In some optional implementations of the present embodiment, above-mentioned apparatus 400 further includes unshowned initialization in Fig. 4 Unit is configured to initialize the chained list being pre-created.
In some optional implementations of the present embodiment, above-mentioned apparatus 400 further includes unshowned deletion list in Fig. 4 Member and the second setting unit.
Unit is deleted, is configured in response to receive the data-delete command for chained list, determines data-delete command The data stored in the position of the node of instruction and the node of deletion data-delete command instruction.
Second setting unit is configured to be arranged the previous node, latter of the position of the node of data-delete command instruction The pointer of node and the node of data-delete command instruction.
In some optional implementations of the present embodiment, above-mentioned apparatus 400 further includes unshowned resetting list in Fig. 4 Member and return unit.
Reset cell is configured to reset the node of data-delete command instruction.
Return unit, the node return node pond after being configured to reset.
In some optional implementations of the present embodiment, pointer includes prior pointer and backpointer.Above-mentioned first setting Unit 404 can be further configured to: the backpointer that the previous node of insertion position is arranged is directed toward idle node;Setting insertion The prior pointer of the latter node of position is directed toward idle node;The prior pointer that idle node is arranged is directed toward the previous node of insertion position And the backpointer of setting idle node is directed toward the latter node of insertion position.
In some optional implementations of the present embodiment, pointer includes prior pointer and backpointer.Above-mentioned second setting Unit is further configured to: the backpointer of the previous node of the position for the node that setting data-delete command indicates is directed toward data The latter node of the position of the node of delete command instruction;The latter node of the position of the node of data-delete command instruction is set Prior pointer be directed toward data-delete command instruction node position previous node;Delete the node of data-delete command instruction Prior pointer and backpointer.
The device for storing data provided by the above embodiment of the application, first can be to the chained list being pre-created point With the continuous node pool of block address memory.Then when receiving the data insertion order to chained list, above-mentioned data insertion is determined The insertion position of instruction is ordered, and obtains idle node from node pool.Then, acquired idle node is write data into In.Finally, according to above-mentioned idle node, the pointer of the previous node of insertion position, latter node and idle node is set.This The device of embodiment is assigned with the continuous node pool of block address memory for chained list, since the operating system in executing subject is each The memory address of the idle node obtained from node pool is relatively continuous, and operating system is mentioned when accessing above-mentioned chained list The probability of height hit caching.To accelerate the speed that operating system reads chained list, it the time needed for reducing traversal chained list, mentions The efficiency of high traversal chained list.
It should be appreciated that the unit 401 recorded in device 400 for storing data is to unit 404 respectively and in reference Fig. 1 Each step in the method for description is corresponding.As a result, above with respect to the operation and feature of method description for storing data It is equally applicable to device 400 and unit wherein included, details are not described herein.
Below with reference to Fig. 5, it illustrates the knots of the computer system 500 for the equipment for being suitable for being used to realize the embodiment of the present application Structure schematic diagram.Equipment shown in Fig. 5 is only an example, should not function to the embodiment of the present application and use scope bring and appoint What is limited.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data. CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always Line 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.; And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon Computer program be mounted into storage section 508 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising carrying is on a machine-readable medium Computer program, which includes the program code for method shown in execution flow chart.In such implementation In example, which can be downloaded and installed from network by communications portion 509, and/or from detachable media 511 It is mounted.When the computer program is executed by central processing unit (CPU) 501, limited in execution the present processes upper State function.
It should be noted that computer-readable medium described herein can be computer-readable signal media or Computer readable storage medium either the two any combination.Computer readable storage medium for example can be --- but Be not limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination. The more specific example of computer readable storage medium can include but is not limited to: have one or more conducting wires electrical connection, Portable computer diskette, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only deposit Reservoir (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory Part or above-mentioned any appropriate combination.
In this application, computer readable storage medium can be any tangible medium for including or store program, the journey Sequence can be commanded execution system, device or device use or in connection.And in this application, it is computer-readable Signal media may include in a base band or as carrier wave a part propagate data-signal, wherein carrying computer can The program code of reading.The data-signal of this propagation can take various forms, including but not limited to electromagnetic signal, optical signal or Above-mentioned any appropriate combination.Computer-readable signal media can also be any other than computer readable storage medium Computer-readable medium, the computer-readable medium can send, propagate or transmit for by instruction execution system, device or Person's device uses or program in connection.The program code for including on computer-readable medium can be with any appropriate Medium transmission, including but not limited to: wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The calculating of the operation for executing the application can be write with one or more programming languages or combinations thereof Machine program code, above procedure design language include object oriented program language-such as Java, Smalltalk, C+ +, it further include conventional procedural programming language-such as " C " language or similar programming language.Program code can Fully to execute, partly execute on the user computer on the user computer, be executed as an independent software package, Part executes on the remote computer or executes on a remote computer or server completely on the user computer for part. In situations involving remote computers, remote computer can pass through the network of any kind --- including local area network (LAN) Or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as utilize Internet service Provider is connected by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction Combination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard The mode of part is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor packet Include allocation unit, acquiring unit, writing unit and the first setting unit.Wherein, the title of these units is under certain conditions simultaneously The restriction to the unit itself is not constituted, for example, allocation unit is also described as " to the chained list storage allocation being pre-created The unit of continuous node pool ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can be Included in device described in above-described embodiment;It is also possible to individualism, and without in the supplying device.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the device, so that should Device: to the continuous node pool of chained list storage allocation being pre-created;The data insertion order of chained list is directed in response to receiving, It determines the insertion position of data insertion order instruction and obtains idle node from node pool;Write data into idle node; According to idle node, the pointer of the previous node of insertion position, latter node and idle node is set.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein Can technical characteristic replaced mutually and the technical solution that is formed.

Claims (14)

1. a kind of method for storing data, comprising:
To the continuous node pool of chained list storage allocation block address being pre-created;
It is directed to the data insertion order of the chained list in response to receiving, determines the insertion position of the data insertion order instruction And idle node is obtained from the node pool;
Write data into the idle node;
According to the idle node, the finger of the previous node of the insertion position, latter node and the idle node is set Needle.
2. according to the method described in claim 1, wherein, the method also includes:
The chained list being pre-created described in initialization.
3. according to the method described in claim 1, wherein, the method also includes:
It is directed to the data-delete command of the chained list in response to receiving, determines the position of the node of the data-delete command instruction Set and delete the data stored in the node of the data-delete command instruction;
Previous node, latter node and the data that the position of the node of the data-delete command instruction is arranged delete life Enable the pointer of the node of instruction.
4. according to the method described in claim 3, wherein, the method also includes:
Reset the node of the data-delete command instruction;
Node after resetting is returned into the node pool.
5. according to the method described in claim 1, wherein, pointer includes prior pointer and backpointer;And
It is described according to the idle node, the previous node and latter node and the idle node of the insertion position are set Pointer, comprising:
The backpointer that the previous node of the insertion position is arranged is directed toward the idle node;
The prior pointer that the latter node of the insertion position is arranged is directed toward the idle node;
The prior pointer that the idle node is arranged is directed toward the previous node of the insertion position and the idle node is arranged Backpointer is directed toward the latter node of the insertion position.
6. according to the method described in claim 3, wherein, pointer includes prior pointer and backpointer;And
The previous node and latter node of the position of the node of the setting data-delete command instruction and the data The pointer of the node of delete command instruction, comprising:
The backpointer that the previous node of the position of the node of the data-delete command instruction is arranged is directed toward the data and deletes life Enable the latter node of the position of the node of instruction;
The prior pointer that the latter node of the position of the node of the data-delete command instruction is arranged is directed toward the data and deletes life Enable the previous node of the position of the node of instruction;
Delete the prior pointer and backpointer of the node of the data-delete command instruction.
7. a kind of device for storing data, comprising:
Allocation unit is configured to the continuous node pool of chained list storage allocation being pre-created;
Acquiring unit is configured in response to receive the data insertion order for the chained list, determines the data insertion It orders the insertion position of instruction and obtains idle node from the node pool;
Writing unit is configured to write data into the idle node;
First setting unit is configured to be arranged according to the idle node previous node, the latter node of the insertion position And the pointer of the idle node.
8. device according to claim 7, wherein described device further include:
Initialization unit is configured to initialize the chained list being pre-created.
9. device according to claim 7, wherein described device further include:
Unit is deleted, is configured in response to receive the data-delete command for the chained list, determines that the data are deleted It orders the position of the node of instruction and deletes the data stored in the node that the data-delete command indicates;
Second setting unit is configured to be arranged the previous node, latter of the position of the node of data-delete command instruction The pointer of node and the node of data-delete command instruction.
10. device according to claim 9, wherein described device further include:
Reset cell is configured to reset the node of the data-delete command instruction;
Return unit, the node after being configured to reset return to the node pool.
11. device according to claim 7, wherein pointer includes prior pointer and backpointer;And
First setting unit is further configured to:
The backpointer that the previous node of the insertion position is arranged is directed toward the idle node;
The prior pointer that the latter node of the insertion position is arranged is directed toward the idle node;
The prior pointer that the idle node is arranged is directed toward the previous node of the insertion position and the idle node is arranged Backpointer is directed toward the latter node of the insertion position.
12. device according to claim 9, wherein pointer includes prior pointer and backpointer;And
Second setting unit is further configured to:
The backpointer that the previous node of the position of the node of the data-delete command instruction is arranged is directed toward the data and deletes life Enable the latter node of the position of the node of instruction;
The prior pointer that the latter node of the position of the node of the data-delete command instruction is arranged is directed toward the data and deletes life Enable the previous node of the position of the node of instruction;
Delete the prior pointer and backpointer of the node of the data-delete command instruction.
13. a kind of equipment, comprising:
One or more processors;
Storage device is stored thereon with one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real Now such as method as claimed in any one of claims 1 to 6.
14. a kind of computer-readable medium, is stored thereon with computer program, wherein the realization when program is executed by processor Such as method as claimed in any one of claims 1 to 6.
CN201810826491.3A 2018-07-25 2018-07-25 Method and apparatus for storing data Active CN109101438B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810826491.3A CN109101438B (en) 2018-07-25 2018-07-25 Method and apparatus for storing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810826491.3A CN109101438B (en) 2018-07-25 2018-07-25 Method and apparatus for storing data

Publications (2)

Publication Number Publication Date
CN109101438A true CN109101438A (en) 2018-12-28
CN109101438B CN109101438B (en) 2020-07-28

Family

ID=64847385

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810826491.3A Active CN109101438B (en) 2018-07-25 2018-07-25 Method and apparatus for storing data

Country Status (1)

Country Link
CN (1) CN109101438B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254364A (en) * 2021-05-24 2021-08-13 山东创恒科技发展有限公司 Information storage device for embedded system
CN115576501A (en) * 2022-12-06 2023-01-06 苏州浪潮智能科技有限公司 Node updating method, system and related device of RAID card

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075214A (en) * 2007-06-28 2007-11-21 腾讯科技(深圳)有限公司 Method and system for managing memory
CN101140531A (en) * 2007-10-10 2008-03-12 中兴通讯股份有限公司 Quick-speed application EMS memory method
CN102760080A (en) * 2011-04-26 2012-10-31 腾讯科技(深圳)有限公司 Memory management method and device
CN104239248A (en) * 2014-09-16 2014-12-24 国家计算机网络与信息安全管理中心 PCI-E (peripheral component interconnect-express) multi-buffer DMA (direct memory access) data transmission method
CN105095261A (en) * 2014-05-08 2015-11-25 北京奇虎科技有限公司 Data insertion method and device
CN105302739A (en) * 2014-07-21 2016-02-03 深圳市中兴微电子技术有限公司 Memory management method and device
US20160077739A1 (en) * 2014-09-16 2016-03-17 Oracle International Corporation System and method for supporting a low contention queue in a distributed data grid
US20180165332A1 (en) * 2015-06-01 2018-06-14 Sap Se Indexing dynamic hierarchical data
US20180181647A1 (en) * 2016-12-28 2018-06-28 Cerner Innovation, Inc. System and Method for Editing a Linked List

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075214A (en) * 2007-06-28 2007-11-21 腾讯科技(深圳)有限公司 Method and system for managing memory
CN101140531A (en) * 2007-10-10 2008-03-12 中兴通讯股份有限公司 Quick-speed application EMS memory method
CN102760080A (en) * 2011-04-26 2012-10-31 腾讯科技(深圳)有限公司 Memory management method and device
CN105095261A (en) * 2014-05-08 2015-11-25 北京奇虎科技有限公司 Data insertion method and device
CN105302739A (en) * 2014-07-21 2016-02-03 深圳市中兴微电子技术有限公司 Memory management method and device
CN104239248A (en) * 2014-09-16 2014-12-24 国家计算机网络与信息安全管理中心 PCI-E (peripheral component interconnect-express) multi-buffer DMA (direct memory access) data transmission method
US20160077739A1 (en) * 2014-09-16 2016-03-17 Oracle International Corporation System and method for supporting a low contention queue in a distributed data grid
US20180165332A1 (en) * 2015-06-01 2018-06-14 Sap Se Indexing dynamic hierarchical data
US20180181647A1 (en) * 2016-12-28 2018-06-28 Cerner Innovation, Inc. System and Method for Editing a Linked List

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254364A (en) * 2021-05-24 2021-08-13 山东创恒科技发展有限公司 Information storage device for embedded system
CN113254364B (en) * 2021-05-24 2022-07-19 山东创恒科技发展有限公司 Information storage device for embedded system
CN115576501A (en) * 2022-12-06 2023-01-06 苏州浪潮智能科技有限公司 Node updating method, system and related device of RAID card
WO2024119775A1 (en) * 2022-12-06 2024-06-13 苏州元脑智能科技有限公司 Raid card node updating method and system, and related apparatus

Also Published As

Publication number Publication date
CN109101438B (en) 2020-07-28

Similar Documents

Publication Publication Date Title
CN109254733B (en) Method, device and system for storing data
CN108537543B (en) Parallel processing method, device, equipment and storage medium for blockchain data
CN109634598A (en) A kind of page display method, device, equipment and storage medium
US10956747B2 (en) Creating sparsely labeled video annotations
CN109033001A (en) Method and apparatus for distributing GPU
CN108228649A (en) For the method and apparatus of data access
CN109213696A (en) Method and apparatus for cache management
CN109543080A (en) A kind of caching data processing method, device, electronic equipment and storage medium
US10789170B2 (en) Storage management method, electronic device and computer readable medium
CN108228646A (en) For accessing the method for data and electronic equipment
CN109460652A (en) For marking the method, equipment and computer-readable medium of image pattern
CN109977102A (en) Data processing method, device, medium and electronic equipment
US20170140032A1 (en) Method & apparatus for asynchroinzed de-serialization of e-r model in a huge data trunk
CN109101438A (en) Method and apparatus for storing data
US20130173961A1 (en) Memory-leak identification
CN109213691A (en) Method and apparatus for cache management
CN109697034A (en) A kind of method for writing data, device, electronic equipment and storage medium
US9891824B2 (en) Sub-block input/output (I/O) commands for storage device including byte stream buffer
CN110119418A (en) Data export method and device
US11151778B2 (en) Optimized browser object rendering
CN112395437B (en) 3D model loading method and device, electronic equipment and storage medium
CN110536283A (en) Terminal identifier acquisition method, device, electronic equipment and medium
CN109635238A (en) Matrix operation method, apparatus, equipment and readable medium
US9697018B2 (en) Synthesizing inputs to preserve functionality
CN108833477A (en) Method for message transmission, system and device based on shared drive

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant