CN102163176B - Methods and devices for memory allocation and interrupted message processing - Google Patents
Methods and devices for memory allocation and interrupted message processing Download PDFInfo
- Publication number
- CN102163176B CN102163176B CN 201110094987 CN201110094987A CN102163176B CN 102163176 B CN102163176 B CN 102163176B CN 201110094987 CN201110094987 CN 201110094987 CN 201110094987 A CN201110094987 A CN 201110094987A CN 102163176 B CN102163176 B CN 102163176B
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 29
- 238000003860 storage Methods 0.000 claims description 174
- 230000014759 maintenance of location Effects 0.000 claims description 12
- 230000015572 biosynthetic process Effects 0.000 claims description 6
- 239000012634 fragment Substances 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 11
- 238000013467 fragmentation Methods 0.000 description 6
- 238000006062 fragmentation reaction Methods 0.000 description 6
- 238000005755 formation reaction Methods 0.000 description 5
- 238000004064 recycling Methods 0.000 description 2
- 238000007599 discharging Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
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
Technical field
The invention belongs to the Computer Storage control field, relate to the 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, namely 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 interrupt message corresponding to triggering for generating, in internal memory, be storage space of this interrupt message distribution;
This interrupt message is added in the pending message queue;
After Message Processing is complete, 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, i.e. 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 process 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 processed comprises:
Receive interruption message, and whether judge in the storage space of address available free address location;
If available free address location then is saved in message storage with interrupt message in the storage space of address;
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 processed comprises:
Receiver module: be used for receive interruption message;
The first judge module: be used for judging whether available free address of address storage space;
Interrupt message is preserved module: if the first judge module is judged available free address in the storage space of address, 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 at the address storage space, remove the address of described message storage.
The method and apparatus that the Memory Allocation that the embodiment of the invention provides, interrupt message are processed 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, the more effective memory headroom that utilizes, 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;
Fig. 6 is the synoptic diagram of internal memory when processing single interrupt message;
The finish dealing with synoptic diagram of rear internal memory of Fig. 7 interrupt message when processing single interrupt message;
Fig. 8 is the synoptic diagram of internal memory when processing a plurality of interrupt message;
The finish dealing with synoptic diagram of rear internal memory of Fig. 9 interrupt message when processing a plurality of interrupt message;
Figure 10 is the apparatus structure synoptic diagram of Memory Allocation;
Figure 11 is the apparatus structure synoptic diagram that interrupting information is processed.
Embodiment
Too much affect 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, the below will be introduced respectively.
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.
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 large I of each unit is distributed as required, make and to store an interrupt message in each unit.
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 arrive corresponding message storage according to this address searching, and obtains the interrupt message of wherein preserving.
According to distribute fixing message storage and address storage space, when handling interrupt message, store interrupt message into fixing position, thereby reduce because in internal memory, storing at random the memory fragmentation that interrupt message produces.
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 processed, and comprising:
When interrupt, processor receives this interrupt message.
Whether step 301 judges in the storage space of address available free 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 can with the space 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 is if available free address in the storage space of address is saved in message storage with interrupt message.
When in the storage space of definite address during available free address, as shown in Figure 6, processor is saved in the interrupt message that receives in the message storage.
If without idle address, can determine that then all message storages are being used for the processing of interrupt message in the storage space of address, the interrupt message that can't obtain processor this moment is saved in the message storage, then this interrupt message is 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 preserving 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 according to the type of interrupt message, respective handling is carried out in interruption, for example when interruption message was press key message, then processor obtained the press key contents of inputting.
Step 400 judges whether described interrupt message is disposed.
Processor judges whether to handle the interrupt message of head of the queue.
Step 401, if interrupt message is disposed, the address of the message storage that described interrupt message is corresponding is saved in address storage space tail of the queue.
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.
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, namely finish the processing for this interrupt message.The interrupt message of storing in the message storage does not discharge, and in the time need to using this message storage next time, directly last interrupt message is covered.
If this moment is interrupt again, then interrupt message is stored in the message storage 2, the address 0x81657DB8 of the message storage 2 of storing among the address storage space B with correspondence is stored to the head of the queue of processing queue, by processor interrupt message is processed.After address storage space A ~ J was used once, then next interrupt message will store in the message storage 1, and again 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 interrupts processing, recycle in this way message storage and address storage space, finish the processing for interrupt message.
When having a plurality of interruptions to process 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 process 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 storing in the processing queue, the corresponding 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 processed, that the present invention also provides a kind of Memory Allocation, interrupt message to process.
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 processed as shown in figure 11, comprising:
Receiver module: be used for receive interruption message;
The first judge module: be used for judging whether available free address of address storage space;
Interrupt message is preserved module: if the first judge module is judged available free address in the storage space of address, then interrupt message is saved in message storage;
Discard module: do not have idle address if the 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 at the address storage space, remove the address of described message storage.
The second judge module: be used for judging whether described interrupt message is disposed;
Second preserves module: if the second judge module judges that interrupt message is disposed, the address of the message storage that described interrupt message is corresponding is saved in address storage space tail of the queue;
Release module: the address that discharges described message storage for the treatment of formation.
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 processed, 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, the more effective memory headroom that utilizes, the travelling speed of quickening computing machine.
The above; be the specific embodiment of the present invention only, but protection scope of the present invention is not limited to this, 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 (8)
1. the method that Memory Allocation, interrupt message are processed 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;
Receive interruption message, and whether judge in the storage space of address available free address location;
If available free address location then is saved in message storage with interrupt message in the storage space of address;
The address of described message storage is saved in processing queue;
In the storage space of address, remove the address of described message storage.
2. the method for Memory Allocation according to claim 1, interrupt message processing is characterized in that, comprising:
If the address storage space does not have idle address location, then abandon interrupt message.
3. the method for Memory Allocation according to claim 1, interrupt message processing is characterized in that, also comprises:
Judge whether described interrupt message is disposed;
If interrupt message is disposed, the address of the message storage that described interrupt message is corresponding is saved in address storage space tail of the queue;
Processing queue discharges the address of described message storage.
4. the method processed of Memory Allocation according to claim 1, interrupt message, it 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.
5. the device that Memory Allocation, interrupt message are processed 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;
Receiver module: be used for receive interruption message;
The first judge module: be used for judging whether available free address of address storage space;
Interrupt message is preserved module: if the first judge module is judged available free address in the storage space of address, 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 at the address storage space, remove the address of described message storage.
6. the device of Memory Allocation according to claim 5, interrupt message processing is characterized in that, comprising:
Discard module: do not have idle address if the first judge module is judged in the storage space of address, then abandon interrupt message.
7. the device of Memory Allocation according to claim 5, interrupt message processing is characterized in that, also comprises:
The second judge module: be used for judging whether described interrupt message is disposed;
Second preserves module: if the second judge module judges that interrupt message is disposed, then the address of the message storage that described interrupt message is corresponding is saved in address storage space tail of the queue;
Release module: the address that discharges described message storage for the treatment of formation.
8. the device processed of Memory Allocation according to claim 5, interrupt message, it 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.
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 CN102163176A (en) | 2011-08-24 |
CN102163176B true 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) |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1271524C (en) * | 2003-03-19 | 2006-08-23 | 华为技术有限公司 | Static internal storage management method |
KR20060108431A (en) * | 2005-04-13 | 2006-10-18 | 삼성전자주식회사 | Method for variable dynamic memory management and embedded system having the same |
CN101604263A (en) * | 2009-07-13 | 2009-12-16 | 浪潮电子信息产业股份有限公司 | A kind of method that realizes multi-duplicate running of core code segment of operation system |
-
2011
- 2011-04-15 CN CN 201110094987 patent/CN102163176B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN102163176A (en) | 2011-08-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8938603B2 (en) | Cache system optimized for cache miss detection | |
CN108038002B (en) | Embedded software memory management method | |
CN101320351A (en) | Internal memory distribution, cleaning and releasing method, and internal memory management apparatus | |
CN102880555A (en) | Memory algorithm facing real-time system | |
EP3504628B1 (en) | Memory management method and device | |
US9983822B1 (en) | Generating and optimizing summary index levels in a deduplication storage system | |
WO2017192284A1 (en) | Generating and optimizing summary index levels in a deduplication storage system | |
WO2015063451A1 (en) | Data processing apparatus and method for processing a plurality of threads | |
CN101488919B (en) | Memory address allocation method and apparatus | |
WO2017092596A1 (en) | Write request processing methodand mobile terminal | |
CN103366386A (en) | Parallel image uncompressing system based on multiple processes and multiple threads | |
CN105677592A (en) | Bus communication method and system | |
CN103425435A (en) | Disk storage method and disk storage system | |
CN114327917A (en) | Memory management method, computing device and readable storage medium | |
CN108536609B (en) | Memory fragment management system and method | |
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 | |
CN105224258B (en) | The multiplexing method and system of a kind of data buffer zone | |
CN104778125A (en) | Method and system for memory management | |
CN102859488A (en) | Coprocessor having task sequence control | |
CN101561783B (en) | Method and device for Cache asynchronous elimination | |
CN110209340B (en) | Access method and device of full flash memory storage system | |
CN108139969A (en) | A kind of internal memory configuring method, apparatus and system | |
CN104008067B (en) | A kind of method and device of data storage |
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 |