Summary of the invention
In view of this, the invention provides a kind of method that realizes the queue sharing storage space, use the method for shared storage space provided by the present invention, can guarantee the reliability of formation to a certain extent, the normal operation of maintenance system.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of method that realizes the queue sharing storage space, this method comprises:
When request of data is gone into formation, after being judged as the storage unit of this formation described data of memory allocated in the storage space of sharing, whether described storage space can ensure that other formations of sharing described storage space enjoy the storage unit of the guarantee number of setting, if, be the required storage unit of this queue assignment, described data are gone into formation;
During the dequeuing data row, be released to storage described data and be the storage unit of queue assignment.
In addition, the present invention provides a kind of device of realizing shared queue's storage space again, uses the device of shared storage space provided by the present invention, can guarantee the reliability of formation to a certain extent, the normal operation of maintenance system.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of device of realizing the queue sharing storage space comprises control module and performance element;
Described control module, receive data and go into the request of formation, after the storage unit that is this formation described data of memory allocated in shared storage space, described storage space can also ensure that other formations of sharing described storage space all enjoy under the situation of storage unit of guarantee number of setting, be this queue assignment storage unit, and indicate described performance element;
Described performance element receives the indication of described control module, and the storage unit that described data is deposited in distribution is carried out the operation that described data are gone into formation; And when the dequeuing data row, be released to storage described data and be the storage unit of queue assignment.
A kind of technical scheme that realizes the queue sharing storage space provided by the present invention, when going into formation by request of data, after being judged as the storage unit of this formation described data of memory allocated in the storage space of sharing, whether described storage space can ensure that other formations of sharing described storage space enjoy the storage unit of the guarantee number of setting, if, be the required storage unit of this queue assignment, described data are gone into formation; Otherwise, refuse the request that described data are gone into formation; During the dequeuing data row, be released to storage described data and be the storage unit of queue assignment.Technical solution of the present invention has been taken all factors into consideration the demand of individual queue by the operation of memory allocated unit is controlled, and makes the individual queue of sharing same storage space guarantee to have the storage unit of some.As seen, because every team has shown the guarantee of basic unit of storage, therefore technical scheme of the present invention has guaranteed the operate as normal of formation, has improved the reliability of formation, has safeguarded the normal operation of system.
Embodiment
In the detailed description of this part, only, illustrate and described preferred embodiment of the present invention by to implementing the example of the desired best mode of inventor of the present invention.It will be appreciated that and not deviate under the prerequisite of the present invention, it is made amendment with regard to each conspicuous aspect.Correspondingly, it is exemplary in itself that drawing and description should be regarded as, rather than restrictive.
The individual queue of sharing storage space is in system's operational process, and major part all is to be in a kind of state near the free time, so the storage unit that most formation only needs to take some just can satisfy the demand of this formation to storage unit.In technical scheme of the present invention, can be by guarantee the storage unit of some for the individual queue of sharing storage space, no matter how the storage unit in the storage space distributes, as long as can ensure this fixed number purpose storage unit for individual queue, just can guarantee the operate as normal of individual queue, and then guarantee the reliability of formation.
The present invention can guarantee the storage unit of some by following technological means for the individual queue of sharing storage space.It is specific as follows: when request of data is gone into formation, after being judged as the storage unit of this formation described data of memory allocated in the storage space of sharing, whether described storage space can ensure that other formations of sharing described storage space enjoy the storage unit of the guarantee number of setting, if, be the required storage unit of this queue assignment, described data are gone into formation.During the dequeuing data row, be released to storage described data and be the storage unit of queue assignment.Like this, can either ensure the storage unit of individual queue, also can realize sharing of storage space simultaneously.
Suppose that storage space comprises 20 storage unit, 3 these storage spaces of queue sharing are arranged, be respectively formation A, B and C.The guarantee number of formation A is 6, and the guarantee number of formation B is 4, and the guarantee number of formation C is 5.Formation A is current to be assigned with 6 storage unit, and formation B has distributed 9 storage unit, and formation C is unallocated.Suppose that current data A need enter formation A, if A distributes a storage unit for formation A again for the storage data, the storage unit that is not assigned with in this storage space is 20-6-9-1=4, and the basic guarantee number of formation C is 5, then can't arrive formation C and ensure 5 storage unit of distribution, the storage unit that is formation A distribution can't ensure the individual queue of sharing described storage space, all enjoys the storage unit of the guarantee number of setting.At this moment, all obtain to ensure the storage unit of number, then refuse the request that data A enters formation A in order to realize individual queue.
In an embodiment of the present invention, can also be after the storage unit that is judged as this formation described data of memory allocated in shared storage space, whether described storage space can ensure that other formations of sharing described storage space enjoy before this operation of storage unit of guarantee number of setting or afterwards, after further being judged as the described storage unit of this queue assignment, the number that whether can make this formation take storage unit exceeds the guarantee number work that this formation is provided with, and is used for further determining whether and need distributes required storage unit for current queue.If after being the described storage unit of this queue assignment, the number that can make this formation take storage unit does not exceed the guarantee number that this formation is provided with, and then is the required storage unit of this queue assignment, and described data are gone into formation.Wherein, described be the described storage unit of this queue assignment after, be meant a kind of state of hypothesis, do not represent to have distributed described storage unit.
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to accompanying drawing and for two example two, the present invention is described in further detail.
At first for the individual queue of sharing same storage space is provided with the guarantee number, the guarantee number that is provided with for individual queue can be identical, also can be inequality.Concrete number can be according to the situation of individual queue self, and for example formation needs average, queue priority and some other factor of storage unit.
In the present embodiment, suppose that storage space comprises 20 storage unit,, be respectively formation A, B and C by 3 these storage spaces of queue sharing.The guarantee number of formation A is 6, and the guarantee number of formation B is 4, and the guarantee number of formation C is 5.The initial total of individual queue who shares this storage space like this ensures that number is 6+4+5=15.In addition, can also safeguard two values, one of them is: the required total guarantee number of individual queue of sharing this storage space; Another one is the Number of Storage Units that has been assigned with in this storage space.Under initial situation, the required total guarantee number of individual queue equals initial total number that ensures.
The present embodiment method comprises that data go into the flow process of formation and dequeuing data row.Referring to Fig. 1, Fig. 1 goes into the flow process of formation for the present embodiment data, comprising:
In step 101, request of data is gone into formation.
In step 102, be judged as the storage unit of this formation described data of memory allocated in the storage space of sharing after, whether can make the number of the storage unit that this formation takies exceed the guarantee number that this formation is provided with, if then execution in step 103; Otherwise, execution in step 104.
For example, suppose that current data A need enter formation A, be assigned with 6 storage unit,, then exceeded the guarantee number of formation A if for storage data A distributes a storage unit for formation A again and formation A is current.
In step 103, be judged as the described storage unit of this queue assignment after, whether the storage unit that is not assigned with in the described storage space can also be to the provide safeguard storage unit of number of other individual queue of sharing storage space, if then execution in step 104; Otherwise, execution in step 105.
Wherein, " after the described storage unit of this queue assignment " of record is a kind of state of hypothesis in step 102 and 103, is not the operation of having carried out the memory allocated unit.
Here, further obtaining to share the current required total guarantee number of described storage space individual queue.So concrete determination methods can be: after being judged as the required storage unit of this queue assignment, whether the number of the storage unit that is not assigned with in the described storage space is more than or equal to the total guarantee number that obtains, if then be the required storage unit of this queue assignment; Otherwise, refuse the request that described data are gone into formation.
Wherein, the current required total guarantee number of individual queue can deduct the interior Number of Storage Units of guarantee number that individual queue has taken with initial total number that ensures.For example, formation A is current to have distributed 6 storage unit, and formation B has distributed 9 storage unit, and formation C is unallocated, and then the current required total guarantee number of individual queue is 15-6-4=5, i.e. the required guarantee number of formation C.And for example, formation A is current to have distributed 4 storage unit, formation B has distributed 9 storage unit, and formation C has distributed 1 storage unit, then the current required total guarantee number of individual queue is 15-4-4-1=6, promptly also need for formation A keeps 2 storage unit, for formation C ensures 4 storage unit.
In step 104, be the required storage unit of this queue assignment, described data are gone into formation, finish current treatment scheme.
In step 105, refuse the request that described data are gone into formation.
In addition, during the dequeuing data row, be released to storage described data and be the storage unit of queue assignment.
In addition, in the method for present embodiment, in order to obtain to share the current required total guarantee number of described storage space individual queue, can also adopt following implementation: obtain the summation of the guarantee number that described individual queue is provided with in advance, and with it as initial total guarantee number; Then, distribute in the number when obtaining storage unit, then, obtain distributing back current required total guarantee number and record successively from described initial total Number of Storage Units that deducts current distribution the number that ensures whenever formation ensures from self; In addition, when formation discharges the storage unit that ensures in the number, then add the Number of Storage Units of release, obtain discharging back current required total guarantee number and record with required total guarantee number before discharging.Like this, the shared current required total guarantee number of described storage space individual queue of concrete acquisition can be the total guarantee number that reads current record.
Above-mentioned put down in writing from self ensure distribute in the number that the storage unit that obtains represents be: the guarantee number of suppose formation A is 8, and preceding 8 storage unit that formation A is assigned with all are called from self and ensure that distribution obtains storage unit in the number.If after formation A has been assigned with 8 storage unit, be assigned with a storage unit again, this moment, this storage unit was not then for distributing the storage unit that obtains in ensureing number.
Here, the technical scheme of the current required total guarantee number of described storage space individual queue being shared in above-mentioned acquisition by following example is elaborated.Equally, suppose that storage space comprises 20 storage unit,, be respectively formation A, B and C by 3 these storage spaces of queue sharing; The guarantee number of formation A is 6, and the guarantee number of formation B is 4, and the guarantee number of formation C is 5, and then initial total guarantee number is 15.For example, at first have data A need enter formation A, be used to store data A for formation A has distributed a storage unit, the current required total guarantee number of individual queue this moment is 15-1=14; Then data B need enter formation B, is used to store data B for formation B has distributed two storage unit, and the current required total guarantee number of individual queue this moment is 14-2=12; Then, data A dequeue, then the current required total guarantee number of individual queue this moment is 12+1=13.
Suppose that formation A is current to have distributed 5 storage unit, formation B has distributed 9 storage unit, and formation C is unallocated.Because only distribute the storage unit that obtains to add the calculating of current required total guarantee number in ensureing number, therefore current required total guarantee number is 6.At this moment, if again for formation A distributes a storage unit, owing to do not distribute the storage unit that obtains in ensureing number, therefore current required total guarantee number still is 6; If formation this moment B discharges a storage unit, because the storage unit that discharges not in ensureing number, therefore need not participate in the calculating of current required total guarantee number equally.
In addition, referring to Fig. 2, Fig. 2 is the structural drawing of present embodiment device.Present embodiment is realized the device of queue sharing storage space, comprises by a plurality of storage unit constituting storage space, also comprises control module and performance element.
Wherein, control module receives the request that data are gone into formation, after the storage unit that is this formation described data of memory allocated in shared storage space, described storage space can also ensure that other formations of sharing described storage space all enjoy under the situation of storage unit of guarantee number of setting, be this queue assignment storage unit, and indicate described performance element.Performance element receives the indication of described control module, and the storage unit that described data is deposited in distribution is carried out the operation that described data are gone into formation; And when the dequeuing data row, be released to storage described data and be the storage unit of queue assignment.
If described control module is after being the described storage unit of this queue assignment, when the number of the storage unit that this formation takies does not exceed the guarantee number of this formation setting, be the required storage unit of this queue assignment.
In addition, this device further comprises acquiring unit.Described acquiring unit obtains to share the current required total guarantee number of described storage space individual queue.Accordingly, described control module obtains the current required total guarantee number of described individual queue from described acquiring unit; If after being the described storage unit of this queue assignment, the number of the storage unit that this formation takies exceeds the guarantee number that this formation is provided with, and under the situation of unappropriated Number of Storage Units more than or equal to the total guarantee number that obtains, be the required storage unit of this queue assignment in the described storage space.
This device further comprises record cell.Described record cell is used to obtain the summation of the guarantee number that described individual queue is provided with, with it as initial total guarantee number; Distribute in the number when obtaining storage unit whenever formation ensures from self, from described initial total Number of Storage Units that deducts current distribution the number that ensures, obtain distributing back current required total guarantee number and record successively; When formation discharges the storage unit that ensures in the number,, obtain discharging back current required total guarantee number and record with discharging the Number of Storage Units that preceding required total guarantee number adds release.Accordingly, described acquiring unit reads total guarantee number of described recording unit records, obtains the current required total guarantee number of described individual queue.
A kind of technical scheme that realizes the queue sharing storage space provided by the present invention, when request of data is gone into formation, after the storage unit for this formation described data of memory allocated in the storage space of sharing, storage space can ensure that still other formations of sharing described storage space enjoy under the situation of storage unit of guarantee number of setting, it just is the required storage unit of queue assignment, carry out described data and go into the operation of formation, and then ensure the storage unit of some for the individual queue of sharing storage space.Technical solution of the present invention has been taken all factors into consideration the demand of individual queue by the operation of memory allocated unit is controlled, and guarantees the storage unit of some for the individual queue of sharing same storage space.As seen, technical solution of the present invention can be guaranteed the operate as normal of individual queue, guarantees the reliability of formation, has safeguarded the normal operation of system.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being made, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.