CN102163176A - Methods and devices for memory allocation and interrupted message processing - Google Patents

Methods and devices for memory allocation and interrupted message processing Download PDF

Info

Publication number
CN102163176A
CN102163176A CN 201110094987 CN201110094987A CN102163176A CN 102163176 A CN102163176 A CN 102163176A CN 201110094987 CN201110094987 CN 201110094987 CN 201110094987 A CN201110094987 A CN 201110094987A CN 102163176 A CN102163176 A CN 102163176A
Authority
CN
China
Prior art keywords
message
address
storage
interrupt
storage space
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
CN 201110094987
Other languages
Chinese (zh)
Other versions
CN102163176B (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.)
Guangzhou Hanvon Zhiyuan Science And Technology Co ltd
Original Assignee
Hanwang 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 Hanwang Technology Co Ltd filed Critical Hanwang Technology Co Ltd
Priority to CN 201110094987 priority Critical patent/CN102163176B/en
Publication of CN102163176A publication Critical patent/CN102163176A/en
Application granted granted Critical
Publication of CN102163176B publication Critical patent/CN102163176B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Multi Processors (AREA)

Abstract

The invention discloses methods and devices for memory allocation and interrupted message processing, belongs to the field of computer memory control and solves the problem of influence on an operating speed of a computer caused by too many memory fragments which are used in a queue. The method for the memory allocation comprises the following steps of: allocating a message memory space for an interrupted message in a memory; dividing the message memory space into at least two sections of continuous message memory units; allocating address memory spaces for the message memory units in the memory; memorizing addresses of the message memory units into the address memory spaces; and constructing an empty processing queue which is used for receiving and memorizing the interrupted message. The method for the interrupted message processing comprises the following steps of: receiving the interrupted message; judging whether idle addresses exist in the address memory spaces; memorizing the interrupted message into the message memory units if the idle addresses exist in the address memory spaces; memorizing the addresses of the message memory units into the processing queue; and clearing away the addresses of the message memory units in the address memory spaces.

Description

The method and apparatus that Memory Allocation, interrupt message are handled
Technical field
The invention belongs to Computer Storage control field, relate to Computer Storage control field, relate in particular to the method and apparatus of a kind of Memory Allocation, interrupt message processing.
Background technology
Prior art to the operation of formation all according to the FIFO(first in first out) mode carry out, promptly only delete at the head of the queue of formation, insert at the tail of the queue of formation.
Existing interrupt message processing mode is as follows:
When interrupting the interrupt message of triggering for generating correspondence, in internal memory, distribute a storage space for this interrupt message;
This interrupt message is added in the pending message queue;
After Message Processing is intact, discharge the shared memory headroom of this interrupt message.
Interrupt message comprises: press key message, flash disk insert message, flash disk is extracted message, SD(Secure Digital Memory Card, safe digital card) card inserts message, the SD card is extracted message, reset message.Interrupt message all is more succinct code, and the memory headroom that occupies is little.
As shown in Figure 1, store file A, interrupt message B in the internal memory.When file C will deposit internal memory in, because memory headroom D can't storage file C, so file C is stored in memory headroom E.Memory headroom D has just become disabled free memory, promptly common described memory fragmentation.Free memory appears at different positions in little and discontinuous mode.
If fragment is too much in the internal memory, can reduce the travelling speed of computing machine.
Summary of the invention
The method and apparatus that embodiments of the invention provide a kind of Memory Allocation, interrupt message to handle reaches the purpose that reduces memory fragmentation.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A kind of method of Memory Allocation comprises:
In internal memory, be interrupt message assignment messages storage space;
The message stores space is divided at least two sections continuous message storages;
In internal memory, for message storage distributes the address storage space;
The address of message storage is saved in the address storage space;
The empty processing queue of structure is used for receiving deposits interrupt message.
The method that a kind of interrupt message is handled comprises:
Receive interrupt message, and judge whether unit, location is idly arranged in the storage space of address;
If unit, location is idly arranged in the storage space of address, then interrupt message is saved in message storage;
The address of described message storage is saved in processing queue;
In the storage space of address, remove the address of described message storage.
A kind of device of Memory Allocation comprises:
Message stores allocation of space module: be used at internal memory, be interrupt message assignment messages storage space;
Message storage is divided module: be used for the message stores space is divided at least two sections continuous message storages;
Address memory allocation module: be used at internal memory, for message storage distributes the address storage space;
Module is preserved in the address: be used for the address of message storage is saved in the address storage space.
The method that a kind of interrupt message is handled comprises:
Receiver module: be used to receive interrupt message;
First judge module: be used for judging whether the address storage space has location idly;
Interrupt message is preserved module: if first judge module is judged in the storage space of address location is idly arranged, then interrupt message is saved in message storage;
First preserves module: be used for the address of described message storage is saved in processing queue;
Module is removed in the address: be used for removing the address of described message storage at the address storage space.
The method and apparatus that the Memory Allocation that the embodiment of the invention provides, interrupt message are handled is interrupt message assignment messages storage space by concentrating, and this message stores spatial division is at least two message storages in internal memory; Avoid in the internal memory certain zone because after being interrupted message and occupying, this zone remainder distributes does not go out, and causes producing the problem of memory fragmentation.The embodiment of the invention is that described message storage distributes the address storage space; By recycling of message storage and address storage space, more efficient use memory headroom, the travelling speed of quickening computing machine.
Description of drawings
Fig. 1 is the synoptic diagram that fragment produces in the internal memory;
Fig. 2 is the process flow diagram of the method for Memory Allocation;
Fig. 3 is the process flow diagram of the method for interrupt message processing;
Fig. 4 is for discharging the process flow diagram of processing queue;
Fig. 5 is the synoptic diagram of Memory Allocation of the present invention;
The synoptic diagram of Fig. 6 internal memory when handling single interrupt message;
The finish dealing with synoptic diagram of back internal memory of Fig. 7 interrupt message when handling single interrupt message;
The synoptic diagram of Fig. 8 internal memory when handling a plurality of interrupt message;
The finish dealing with synoptic diagram of back internal memory of Fig. 9 interrupt message when handling a plurality of interrupt message;
Figure 10 is the apparatus structure synoptic diagram of Memory Allocation;
The apparatus structure synoptic diagram that Figure 11 handles for interrupting information.
Embodiment
Too much influence the problem of the operational speed of a computer in order to solve memory fragmentation, the invention provides the method and apparatus of a kind of Memory Allocation, interrupt message processing, will be introduced respectively below.
A kind of method of Memory Allocation as shown in Figure 2, comprising:
Step 200 in internal memory, is interrupt message assignment messages storage space.
As shown in Figure 5, in internal memory, distribute fixing message stores space.
Step 201 is divided at least two sections continuous message storages with the message stores space.
Described message stores space is divided at least two sections continuous message storages, for example can be divided into 10 message storages.Because interrupt message comprises: press key message, movable storage device insert message, movable storage device is extracted message and reset message, movable storage device comprises flash disk and safe digital card, and each interrupt message takes up space seldom, so the big I of each unit is distributed as required, makes and can store an interrupt message in each unit.
Step 202 is in internal memory, for message storage distributes the address storage space.
Step 203 is saved in the address storage space with the address of message storage.
Each message storage has a definite address, the address of message storage is saved in the address storage space, for example, as shown in Figure 5, the address correspondence of message storage 1 to 10 is saved among the storage space A ~ J of address, and the corresponding relation of the address of message storage and A ~ J address storage space as shown in Figure 5.Processor can be according to this address searching to corresponding message storage, and the interrupt message that obtains wherein to be preserved.
According to distribute fixing message storage and address storage space, when handling interrupt message, store interrupt message into fixing position, thereby reduce because of in internal memory, storing the memory fragmentation that interrupt message produces at random.
Step 204, the empty processing queue of structure receives deposits interrupt message.
The empty processing queue and the size of message addresses storage space can change according to the size in message stores space, for example, when the size definition in message stores space is N, the maximal value of message addresses storage queue and processing queue also is N, the storage because can only circulate between two formations in the address of storage space, so the summation of message addresses storage queue and processing queue element is N.
For raising utilizes the efficient of the handling interrupt message of memory headroom, accelerate the travelling speed of computing machine, as shown in Figure 3, the present invention proposes the method that a kind of interrupt message is handled, and comprising:
Step 300 receives interrupt message.
When taking place to interrupt, processor receives this interrupt message.
Step 301 judges whether location is idly arranged in the storage space of address.
Processor is judged in the storage space of address, the address that whether has untapped message storage, can determine whether to exist in the message storage available space to store interrupt message, the address 0x81658DA8 that for example has message storage 1 among the address storage space A can determine that message storage 1 can preserve interrupt message.
Step 302 if location is idly arranged in the storage space of address, is saved in message storage with interrupt message.
When the location was arranged in the storage space of definite address idly, as shown in Figure 6, processor was saved in the interrupt message that receives in the message storage.
If no idle address in the storage space of address can determine that then all message storages are being used for the processing of interrupt message, can't be saved in the interrupt message that processor obtained in the message storage this moment, then this interrupt message abandoned.
Step 303 is saved in processing queue with the address of described message storage.
After storing interrupt message into message storage, the address that the address storage space will be stored the message storage of this interrupt message is saved in the processing queue, as interrupt message is stored in the message storage 1, and the address 0x81657DA8 of the message storage 1 preserved among the storage space A of address stored in the processing queue.
Step 304 in the storage space of address, is removed the address of described message storage.
After the address of message storage is saved in processing queue, this address of being preserved in the storage space of address is removed, and the address of remainder is pushed to head of the queue.Processor scans processing queue, when in finding processing queue, storing the address of message storage, then, respective handling is carried out in interruption according to the type of interrupt message, for example when interruption message was press key message, then processor obtained the button content of being imported.
Step 400 judges whether described interrupt message disposes.
Processor judges whether to handle the interrupt message of head of the queue.
Step 401 if interrupt message disposes, is saved in address storage space tail of the queue with the address of the message storage of described interrupt message correspondence.
After the processing of finishing interrupt message, the address of message storage is stored to the tail of the queue of address storage space, recycle, for example, as shown in Figure 7, the address of message storage 1 is saved in storage space tail of the queue place, address.
Step 402, processing queue discharge the address of described message storage.
Be stored in the tail of the queue of address storage space when the address after, discharge the address of message storage described in the processing queue, promptly finish processing for this interrupt message.The interrupt message of being stored in the message storage does not discharge, and in the time need using this message storage next time, directly last interrupt message is covered.
If interrupt this moment once more, then interrupt message is stored in the message storage 2, the address 0x81657DB8 of the message storage 2 stored among the corresponding address storage space B is stored to the head of the queue of processing queue, interrupt message is handled by processor.After address storage space A ~ J was used once, then next interrupt message will store in the message storage 1, and once more the address 0x81657DA8 of the message storage 1 stored among the storage space A of address is saved in processing queue, wait for that processor carries out Interrupt Process, recycle message storage and address storage space in this way, finish processing for interrupt message.
When having a plurality of interruptions to handle simultaneously simultaneously, as shown in Figure 8, the address storage space stores the address of a plurality of message storages in the processing queue in order, be that processor just has a plurality of interrupt messages to need to handle the address of for example preserving message storage 1 ~ 4 in the processing queue by the scanning for processing queue as can be known; Processor is according to the address of the message storage of being stored in the processing queue, the pairing interrupt message the processing messages storage unit one by one from the head of the queue of processing queue to tail of the queue, and add the address of finishing the message stores space of processing the tail of the queue of address storage space to, as shown in Figure 9.
The device corresponding with the method that above-mentioned a kind of Memory Allocation, interrupt message are handled, that the present invention also provides a kind of Memory Allocation, interrupt message to handle.
A kind of device of Memory Allocation as shown in figure 10, comprising:
Message stores allocation of space module: be used at internal memory, be interrupt message assignment messages storage space;
Message storage is divided module: be used for the message stores space is divided at least two sections continuous message storages;
Address memory allocation module: be used at internal memory, for message storage distributes the address storage space;
Module is preserved in the address: be used for the address of message storage is saved in the address storage space.
The device that a kind of interrupt message is handled as shown in figure 11, comprising:
Receiver module: be used to receive interrupt message;
First judge module: be used for judging whether the address storage space has location idly;
Interrupt message is preserved module: if first judge module is judged in the storage space of address location is idly arranged, then interrupt message is saved in message storage;
Discard module: do not have idle address if first judge module is judged in the storage space of address, then abandon interrupt message.
First preserves module: be used for the address of described message storage is saved in processing queue;
Module is removed in the address: be used for removing the address of described message storage at the address storage space.
Second judge module: be used to judge whether described interrupt message disposes;
Second preserves module: if second judge module judges that interrupt message disposes, the address of the message storage of described interrupt message correspondence is saved in address storage space tail of the queue;
Release module: be used for the address that processing queue discharges described message storage.
Described interrupt message comprises: press key message, movable storage device insert message, movable storage device is extracted message and reset message, and wherein, movable storage device comprises flash disk and safe digital card.
The method and apparatus that the Memory Allocation that the embodiment of the invention provides, interrupt message are handled, be interrupt message assignment messages storage space by in internal memory, concentrating, and this message stores spatial division is at least two message storages, avoided in the internal memory certain zone because after being interrupted message and occupying, this zone remainder distributes does not go out, cause producing the problem of memory fragmentation, for described message storage distributes the address storage space; By recycling of message storage and address storage space, more efficient use memory headroom, the travelling speed of quickening computing machine.
The above; only be the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.

Claims (10)

1. the method for a Memory Allocation is characterized in that, comprising:
In internal memory, be interrupt message assignment messages storage space;
The message stores space is divided at least two sections continuous message storages;
In internal memory, for message storage distributes the address storage space;
The address of message storage is saved in the address storage space;
The empty processing queue of structure is used for receiving deposits interrupt message.
2. the method that interrupt message is handled is characterized in that, comprising:
Receive interrupt message, and judge whether unit, location is idly arranged in the storage space of address;
If unit, location is idly arranged in the storage space of address, then interrupt message is saved in message storage;
The address of described message storage is saved in processing queue;
In the storage space of address, remove the address of described message storage.
3. the method that interrupt message according to claim 2 is handled is characterized in that, comprising:
If the address storage space does not have idle address location, then abandon interrupt message.
4. the method that interrupt message according to claim 2 is handled is characterized in that, also comprises:
Judge whether described interrupt message disposes;
If interrupt message disposes, the address of the message storage of described interrupt message correspondence is saved in address storage space tail of the queue;
Processing queue discharges the address of described message storage.
5. the method that interrupt message according to claim 2 is handled is characterized in that described interrupt message comprises: press key message, movable storage device insert message, movable storage device is extracted message and reset message.
6. the device of a Memory Allocation is characterized in that, comprising:
Message stores allocation of space module: be used at internal memory, be interrupt message assignment messages storage space;
Message storage is divided module: be used for the message stores space is divided at least two sections continuous message storages;
Address memory allocation module: be used at internal memory, for message storage distributes the address storage space;
Module is preserved in the address: be used for the address of message storage is saved in the address storage space.
7. the device that interrupt message is handled is characterized in that, comprising:
Receiver module: be used to receive interrupt message;
First judge module: be used for judging whether the address storage space has location idly;
Interrupt message is preserved module: if first judge module is judged in the storage space of address location is idly arranged, then interrupt message is saved in message storage;
First preserves module: be used for the address of described message storage is saved in processing queue;
Module is removed in the address: be used for removing the address of described message storage at the address storage space.
8. the device that interrupt message according to claim 7 is handled is characterized in that, comprising:
Discard module: do not have idle address if first judge module is judged in the storage space of address, then abandon interrupt message.
9. the device that interrupt message according to claim 7 is handled is characterized in that, also comprises:
Second judge module: be used to judge whether described interrupt message disposes;
Second preserves module: if second judge module judges that interrupt message disposes, then the address with the message storage of described interrupt message correspondence is saved in address storage space tail of the queue;
Release module: be used for the address that processing queue discharges described message storage.
10. the device that interrupt message according to claim 7 is handled is characterized in that described interrupt message comprises: press key message, movable storage device insert message, movable storage device is extracted message and reset message.
CN 201110094987 2011-04-15 2011-04-15 Methods and devices for memory allocation and interrupted message processing Expired - Fee Related CN102163176B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110094987 CN102163176B (en) 2011-04-15 2011-04-15 Methods and devices for memory allocation and interrupted message processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110094987 CN102163176B (en) 2011-04-15 2011-04-15 Methods and devices for memory allocation and interrupted message processing

Publications (2)

Publication Number Publication Date
CN102163176A true CN102163176A (en) 2011-08-24
CN102163176B CN102163176B (en) 2013-04-03

Family

ID=44464412

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110094987 Expired - Fee Related CN102163176B (en) 2011-04-15 2011-04-15 Methods and devices for memory allocation and interrupted message processing

Country Status (1)

Country Link
CN (1) CN102163176B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1532708A (en) * 2003-03-19 2004-09-29 华为技术有限公司 Static internal storage management method
US20060236065A1 (en) * 2005-04-13 2006-10-19 Woo Hyong Lee Method and system for variable dynamic memory management
CN101604263A (en) * 2009-07-13 2009-12-16 浪潮电子信息产业股份有限公司 A kind of method that realizes multi-duplicate running of core code segment of operation system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1532708A (en) * 2003-03-19 2004-09-29 华为技术有限公司 Static internal storage management method
US20060236065A1 (en) * 2005-04-13 2006-10-19 Woo Hyong Lee Method and system for variable dynamic memory management
CN101604263A (en) * 2009-07-13 2009-12-16 浪潮电子信息产业股份有限公司 A kind of method that realizes multi-duplicate running of core code segment of operation system

Also Published As

Publication number Publication date
CN102163176B (en) 2013-04-03

Similar Documents

Publication Publication Date Title
CN108038002B (en) Embedded software memory management method
CN107665146B (en) Memory management device and method
US20130326154A1 (en) Cache system optimized for cache miss detection
CN101320351A (en) Internal memory distribution, cleaning and releasing method, and internal memory management apparatus
CN102880555A (en) Memory algorithm facing real-time system
CN101286878B (en) Management method of memory pool for terminal
CN110780823B (en) Small object memory management method, small object memory management device, electronic equipment and computer readable medium
WO2017192284A1 (en) Generating and optimizing summary index levels in a deduplication storage system
CN101488919B (en) Memory address allocation method and apparatus
WO2017092596A1 (en) Write request processing methodand mobile terminal
CN102821164A (en) Efficient parallel-distribution type data processing system
CN103366386A (en) Parallel image uncompressing system based on multiple processes and multiple threads
CN103378919A (en) Frame information (FI) message transmission method and apparatus
CN101707565A (en) Method and device for transmitting and receiving zero-copy network message
CN103425435A (en) Disk storage method and disk storage system
CN109947720A (en) A kind of pre-reading method of files, device, equipment and readable storage medium storing program for executing
CN101272254B (en) Method for generating attack characteristic database, method for preventing network attack and device thereof
CN108536609B (en) Memory fragment management system and method
CN114327917A (en) Memory management method, computing device and readable storage medium
CN113342886A (en) Data exchange method and device
CN107066335A (en) A kind of optimization method of cloud platform internal memory and optimization system
CN102163176B (en) Methods and devices for memory allocation and interrupted message processing
CN111338981B (en) Memory fragmentation prevention method and system and storage medium
CN103970672A (en) Message memory management method and system
CN105786917A (en) Concurrent time series data loading method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20171023

Address after: 510660 C308 room, No. 5 Fu Yuan middle road, Guangzhou, Guangdong, Tianhe District (only for office use) (not for workshop use)

Patentee after: Guangzhou Hanvon Zhiyuan science and Technology Co.,Ltd.

Address before: 100193 Beijing, Haidian District, northeast Wang West Road, building three, floor 5, layer 8

Patentee before: HANWANG TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20130403

CF01 Termination of patent right due to non-payment of annual fee