The two-stage optimizing method that a kind of user circuit is selected
Technical field
The present invention relates to the two-stage optimizing that a kind of user circuit board is selected, especially the two-stage optimizing method that user circuit is selected in the communication system hardware device.
Background technology
Management and allotment in resources such as power, the energy, data, resource such as circuit, channel every field such as calls in the communication system, especially in communication system, as all relating to the problem of how rationally fully balancedly utilizing circuit resource in the stored-program control exchange, in the access server.Adopt what kind of method to carry out the selection of subscriber line circuit, can rationally abundant balanced utilization of hardware resources just become the key of problem.
The method that existing user circuit is selected generally adopts tandem method, is promptly undertaken by following step:
(1) whole user circuit boards is numbered from 0~n according to certain sequence, and the circuit on every block of user's plate also according to certain sequence from 0~m numbering, every x piece circuit board uses a HW line (communication channel between user circuit board and the systems network administration plate);
(2) when receiving the call request, when needing to select an idle circuit to finish this call proceeding, system at first selects circuit board No. 0, and whether No. 0 circuit that detects this plate is idle, if not idle, then detect circuit No. 1 ... detect, till finding an idle circuit so always;
(3) if on No. 0 circuit board, fail to find idle circuit, then jump to No. 1 circuit board and carry out similar detection, till finding an idle circuit, or jump on next piece circuit board and similarly detect;
(4) if detecting whole m * n bar circuit altogether that are over does not find yet, then return failure.The advantage of tandem method is that thinking is simple and clear, is easier to programming and realizes that method used when at every turn seeking idle circuit is the same, therefore only need write a function and get final product; When whether testing circuit is idle, can be Status Flag of every circuit definition in advance, it is idle, busy and inaccessible that its value is respectively, during detection, only need judge whether the Status Flag of this circuit is idle get final product, go to finish when this circuit is selected that call continues or by the backstage manual block, its Status Flag need be set to respective value to get final product, work as user offline, again the Status Flag of this circuit is put not busy the getting final product of making the return trip empty.
But its shortcoming is very outstanding also, at first: all need when selecting idle circuit to detect since No. 0 circuit of No. 0 plate at every turn, if the less words of system's login user, then can find an idle circuit soon, but, then on this link of searching idle circuit, will spend many times and system resource if this moment, system's login user was more; Secondly, the basic process of tandem method is when all circuit on No. 0 circuit board all are in busy state, just can remove to select No. 1 circuit board, the rest may be inferred, the result of its generation is, numbering several circuit boards the preceding always is in the oepration at full load state, especially former circuit of No. 0 plate, and several circuit board and the circuit selected chance of finishing call proceeding of numbering after leaning on is considerably less, so just make the load of whole system very uneven, the circuit board and the circuit that always are in full load condition must be out of order easily, cause the rising of system's drop rate, and some circuit board and circuit always are in idle condition, cause resource waste.
Summary of the invention
In order to overcome the shortcoming of tandem method, the object of the present invention is to provide a kind of two-stage optimizing method, make full use of the available circuit resource, balance sysmte load, the reduction system drop rate that continues; Provide quick, reasonable, balanced, select circuit methods efficiently, demands such as dialling up on the telephone of efficient stable and call proceeding service are provided for the user.
The two-stage optimizing method that user circuit of the present invention is selected, implementation step is as follows:
(1) according to the capacity and the distribution condition of the communication channel between system user circuit board and the systems network administration plate (HW line), all subscriber line circuits are divided into two-stage: cell level and subelement level, a module is composed of multiple units altogether, each unit takies the communication channel between a user circuit board and the systems network administration plate, each unit is made up of the polylith user circuit board, a circuit board is again a subelement, and each subelement has many subscriber line circuits that can be used for complete connection again;
(2) when receiving the call request, when needing to select a circuit to finish this call proceeding;
(3) begin to detect each unit, determine the idle circuit number of each unit;
(4) select a maximum unit of idle circuit number;
(5) detect each user circuit board idle circuit number in the selected unit;
(6) in (4), select the subelement that the idle circuit number is maximum in the selected cell;
(7) in (6), select an idle circuit in the selected subelement;
(8) idle circuit selected in (7) is continued.
In the described two-stage optimizing method, each subelement has all been created three formations respectively: idle, busy, inaccessible.
In the described two-stage optimizing method, the idle circuit that continues is to select in the idle queues in subelement.
In the described two-stage optimizing method, in idle queues, select idle circuit to carry out according to the principle of idle circuit first in first out.
Description of drawings
Also in conjunction with specific embodiments technical scheme of the present invention is further launched explanation below by accompanying drawing,
Fig. 1 is the flow chart of the two-stage optimizing method of user circuit selection of the present invention;
Fig. 2 carries out the principle key diagram that subscriber line circuit is selected in the embodiment of the invention.
Embodiment
Two-stage optimizing method flow process shown in Figure 1 illustrates in technical scheme, just no longer repeats at this.
As shown in Figure 2, suppose that at its subscriber line circuit number of a system be m * n * p, m bar HW line is wherein arranged, earlier subscriber line circuit is subdivided into m unit, each unit has n subelement (circuit board) again, and each subelement has p the circuit that can Gong continue.
(1) with the following structure of C language definition:
typedef?struct{
WORD?IdleNum;
BYTE Unit;
}UNITCACHE;
Wherein: Unit is a unit number, and IdleNum is the idle circuit number of this element; During system start-up, will detect or the method for reading database obtains the idle circuit number of each unit by system;
(2) unit number of initialization system is m, therefore can utilize the structure UNITCACHE of definition in (1) step to be defined as follows the structure array:
typedef?UNITCACHE UNITCACHE?DM[m];
In the time will seeking the maximum unit of idle circuit, be inlet with this array, by the field IdleNum in the comparative structure body array, obtain corresponding Unit.Certainly, in order to raise the efficiency, when system start-up or idle circuit number change, all will be to this structure array by the idle circuit number from how to arrange to few order, like this, when seeking the unit, can directly get UNITCACHE_DM[0 at every turn] get final product;
(2) be defined as follows structure:
typedef?struct{
BYTE IdleNum;
BYTE Unit;
BYTE Sunit;
HANDLE?hQUE;
}SEQCACHE;
Wherein: Unit is a unit number, and Sunit is the subelement number in the Unit unit, and IdleNum is the idle circuit number of subelement for this reason, and hQUE is the handle of subelement idle circuit place formation for this reason; Equally, during system start-up, will detect or the method for reading database obtains the idle circuit number of each subelement by system;
(3) the subelement number of setting in each unit is n, is defined as follows array:
typedef?SEQCACHE SEQCACHE_DM[mXn];
In the time will seeking the maximum subelement of idle circuit, with this array is inlet, earlier obtained Unit dwindles seek scope to n subelement when seeking maximum unit, then by comparing this n the field IdleNum in the sub-cell array, obtain corresponding Sunit, and obtained the handle hQUE of idle circuit place formation in this subelement by this Sunit;
(4) for each subelement, we are that it has created three formations: idle (IDLE), busy (BUSY), inaccessible (BLOCK), and idle queues is followed the principle of first in first out (FIFO), and promptly the pointer of this idle queues points to the circuit number of putting into this idle queues at first all the time.When we have obtained the handle hQUE of idle circuit place formation in idle certain subelement, directly get final product with taking out a circuit number in the pointer formation from then on, like this, just finished the operation of an idle circuit of two-stage optimizing searching.
As can be seen, above embodiment does not have special requirement to the system that user circuit need carry out two-stage optimizing, therefore has bigger versatility.
From the angle of selected cell and subelement, the standard of selection is that the idle circuit number is maximum, so just makes the load of whole system balanced more;
From selecting the angle of circuit, because the use of formation and pointer makes program operation speed faster, efficient is higher, and because idle queues has been followed first in first out (FIFO) principle, so just makes that choosing of circuit is convenient; Because the use of inaccessible formation, certain bar circuit is fallen on backstage obturation as required, makes consistency operation convenient, thereby can improve jointing-success-rate of calling widely;
From user's angle, call proceeding speed is faster, has higher success rate.
The present invention provides a kind of reasonable, fully balanced solution for distribution, the use of subscriber line circuit resource in the communication system.Because the versatility of the inventive method, and can it in other association area, promote the use of, the good technical effect obtained.