Embodiment
The embodiment of the invention is in order to effectively reduce the degree of coupling of each kernel software module in the micro-kernel system; Solve the problem of the system performance reduction that each kernel software module communication causes in the micro-kernel system; The communication means of software module in a kind of micro-kernel system is provided; The information bank module is according to the information request to the first kernel software module that receives in this method; Confirming as this information request provides the information of information table of this first kernel software module of service, this information table is operated, and sent result.Owing to all be provided with corresponding information table to each kernel software module in the embodiment of the invention information bank module; At needs during from the first kernel software module solicited message; Direct and information bank module is carried out alternately, need not to carry out alternately with the first kernel software module again, has therefore reduced the influence to the first kernel software module performance; Also reduce the degree of coupling between each kernel software module in the micro-kernel system, thereby improved the performance of micro-kernel system.
Below in conjunction with Figure of description, the embodiment of the invention is elaborated.
In embodiments of the present invention in order to effectively reduce the degree of coupling between the kernel software module in the micro-kernel system; In this micro-kernel system, increase the information bank module; In the time need carrying out solicited message between the kernel software module; With sending to the information request that this needs the kernel software module of solicited message before, send to the information bank module.The information bank module is for the ease of providing service to each kernel software module; In this information bank module, preserved information table that should the kernel software module, recorded this kernel software module in this information table and restart required restore data of back operation and the interface data that externally provides to each kernel software module.
The information bank module according to receive to the information request of the first kernel software module time; Be directed against in the information table of each kernel software module what self preserve; Search information to the information table of this first kernel software module; In the information table that this finds, this information table is handled accordingly, and after finishing dealing with, returned result according to this information request.
The concrete treatment effeciency that is directed against the information request of each kernel software module in embodiments of the present invention for further raising information bank resume module can be directed against each information table in this information bank module, create the sub-thread of safeguarding this information table.In information table, when handling accordingly, can handle accordingly this information request through the sub-thread that this information table is safeguarded to information request.
The communication process of software module in the micro-kernel system that Fig. 1 provides for the embodiment of the invention, this process may further comprise the steps:
S101: the information bank module receives the information request to the first kernel software module.
In embodiments of the present invention when the kernel software module in the micro-kernel system need be to the first kernel software module solicited message; For example need be when the first kernel software module be obtained interface data; When the information in self the information table of perhaps in this first kernel software module need be to the information bank module, preserving is made amendment; Or; Obtain in the first kernel software module need be preserved from information bank the information table of self when restarting the required restore data of back operation, send information request to this first kernel software module to this information bank module.
Concrete, the first kernel software module is sent the information request that is directed against the first kernel software module to said information bank module when definite restore data or interface data change, and wherein carries restore data or interface data after the variation in this information request; Or,
When the first kernel software module brings into operation, send information request to the first kernel software module to said information bank module after restarting; Or,
The second kernel software module is sent the information request to the first kernel software module to said information bank module when confirming to call the interface data of the first kernel software module.
S102:, confirm as the information of information table that this information request provides the first kernel software module of information according to this information request.
The information bank module is directed against each kernel software module creation and has distributed corresponding information table in embodiments of the present invention, and in this information bank module, is directed against the corresponding sub-thread of each kernel software module creation, and each information table is safeguarded by the sub-thread of correspondence.
For example in this information bank module, comprise kernel software modules A, kernel software module B and kernel software module C etc., information bank module creation first information table, second information table and the 3rd information table.Wherein this first information table is used for to the information request of this kernel software modules A of request information being provided; Second information table is used for to the information request of request kernel software module B information being provided; The 3rd information table is used for to the information request of request kernel software module C information being provided; And the first sub-thread is used to safeguard first information table, and the second sub-thread is used to safeguard second information table, and the 3rd sub-thread is used to safeguard the 3rd information table.
S103: according to the definite sub-thread that this information table is safeguarded of the information of this information table, in this information table, handle accordingly, and send result according to said information request through this sub-thread.
Concrete information bank module is mounted to said information request on the request chained list of this information table; Wake the sub-thread that this is confirmed up; Through the said sub-thread that wakes up, in this information table, handle accordingly according to said information request, with the result carry on the result chained list; Announce said main thread and finish dealing with, this main thread takes off result and transmission from the result chained list.
This information bank module is the module that is independent of each kernel software module in embodiments of the present invention; In this information bank module, be directed against each kernel software module; Establishment is to information table that should the kernel software module; And the information table that should create can be one, two or more, and specifically the characteristic according to the kernel software module determines.This information bank module is to the corresponding sub-thread of each kernel software module creation simultaneously, and each information table can only be safeguarded by a sub-thread, and a sub-thread can be safeguarded a plurality of information tables.
In addition; This information bank module is the module that is independent of each kernel software module; Because the logic of this information bank module is fairly simple; Himself need not carry out the processing of inherent logic as other kernel software modules, therefore can more effectively solve the communication issue of kernel software intermodule in the micro-kernel system through the information bank module, improves the performance of micro-kernel system.
Can in the information bank module, create a plurality of information tables in embodiments of the present invention, wherein the corresponding kernel software module of each information table.Preserve corresponding kernel software module in each information table and restart required restore data of back operation and the interface data that externally provides.Promptly in the micro-kernel system kernel software module self restart the required configuration data of back operation and restarting before status data during operation, reach to the interface data that other kernel software modules provide and can be kept in should the information table of kernel software module.
For example working as this kernel software module is the ROUTING module; To having preserved routing iinformation in the information table of kernel software module creation; The interface data that this routing iinformation outwards provides for this ROUTING module; I.e. this ROUTING module information that need provide to other kernel software modules, this information need communicate the information of obtaining with the ROUTING module for other kernel software modules.For the V6STACK module; To having preserved transmission control protocol (Transmission Control Protocol in the information table of kernel software module creation; TCP) status information and user datagram protocol (User Datagram Protocol, UDP) status information etc.For the INTF module, to preserving MTU (Maximum Transmission Unit, MTU) information and operation desired parameters information etc. in the information table of kernel software module creation.
According to the characteristic of each kernel software module, can be directed against the two or more information tables of this kernel software module creation.For example the information bank module can be directed against the ROUTING module creation first information table and second information table, wherein can write down the V4 routing iinformation in the first information table, can write down the V6 routing iinformation in second information table.
The information bank module has been directed against each kernel software module creation behind the corresponding information table, and this information table is safeguarded through the sub-thread to this kernel software module creation.Be that the information bank module is directed against the sub-thread of each kernel software module creation, this sub-thread is used to be maintained as the information table of this kernel software module creation.
Because the information bank module possibly created two or more information tables to a certain kernel software module; This information bank module can only be created a sub-thread to this kernel software module, is maintained as each information table of this kernel software module creation through this sub-thread of creating.Perhaps in order to improve the efficient that information request is handled; Further improve the performance of micro-kernel system; When the information bank module has been directed against a certain kernel software module creation behind two or more information tables; Can create the sub-thread of respective amount to the quantity that is the information table of this kernel software module creation, each sub-thread is safeguarded an information table.Above-mentioned information bank module is the process of each kernel software module creation information table and sub-thread; The user can select the corresponding implementation mode flexibly according to the needs of self, all should be included in protection scope of the present invention through the implementation of sub-thread maintenance information table as long as can realize.
Receive in this information bank module of the embodiment of the invention is the main thread in this information bank module to the information request of the first kernel software module; This main thread is after receiving each information request; Information according to the requested first kernel software module of carrying in this information request; Can confirm as this information request provides the information of information table of this first kernel software module of information; And this main thread can confirm to safeguard the sub-thread of this information table according to the information of this information table, thereby can handle accordingly this information table according to this information request through this sub-thread.And when sub-thread process is accomplished with the result carry on the result chained list; The announcement main thread is finished dealing with; After main thread receives this announcement, take off this result, send to the kernel software module of sending this information request from this result chained list.
Owing to all created corresponding information table to each kernel software module in the information bank module; And each information table is all safeguarded through the sub-thread of correspondence; Be that each information table can only be safeguarded by a sub-thread; Therefore the kernel software module need not to use data protection, thereby can reduce kernel software Module Design difficulty, and can guarantee effectively that the kernel software module effectively gets access to self required data message.In addition; Owing to need not directly to communicate by letter between the kernel software module; Therefore avoided waiting for each other between the kernel software module deadlock problem of giving out a contract for a project and causing; Effectively raise the kernel software module and obtain the efficient of interface data, improved the performance of micro-kernel system from other kernel software modules.
In addition; In embodiments of the present invention because when after the kernel software module is restarted, bringing into operation; The request of will restarting also sends to the information bank module; Provide this kernel software module to restart the required restore data of back operation through the information bank module to this kernel software module; Required restore data comprised the status data when moving before these kernel software modules configured data and this kernel software module are restarted when this restarted the back operation; Since other kernel software modules after this is restarted, to need to need not again the kernel software module of operation that configuration information is provided and restart before status information during operation, so reduced, thereby improved the overall performance of micro-kernel disposal system other kernel software resume module Effect on Performance.
In embodiments of the present invention the request that receives of information bank module from the first kernel software module obtain information information request can for: the request of information table content modification, the request of restarting and the operations such as request of obtaining interface data describe to the communication process of different information request to software module in the micro-kernel system in the embodiment of the invention respectively below.
Fig. 2 for the embodiment of the invention provide when this information request is the request of information table content modification, the communication process of software module in the micro-kernel system, this process may further comprise the steps:
S201: the main thread of information bank module receives that the first kernel software module sends, and to the information table content modification request of the first kernel software module, wherein carries content information to be added in this information table content modification request.
S202: the main thread of information bank module is according to the information table that is assigned with for each kernel software module creation, confirms as the information of information table that the request of information table content modification provides this first kernel software module of information.
Because the information bank module is directed against each kernel software module creation and has distributed corresponding information table in embodiments of the present invention; Therefore when the main thread of information bank module receive that the first kernel software module sends be directed against the information table content modification request of the first kernel software module after; The information table content modification request that need confirm as this first kernel software module provides which information table that is of information; Thereby can in this this information table of confirming, this information table be handled accordingly according to this information table content modification request.
S203: according to the definite sub-thread that this information table is safeguarded of the information of this information table.
Because the information bank module has been distributed corresponding information table to each kernel software module creation; And each information table is safeguarded by the sub-thread of correspondence; Therefore after the information of having confirmed the information table that the information of carrying out provides; Can confirm the sub-thread that this information table is safeguarded according to the information of this information table.
S204: this information table content modification request is mounted on the request chained list of this information table, wakes the sub-thread that this information table is handled up.
The information bank module sub-thread that has been each kernel software module assignment in embodiments of the present invention, each sub-thread is used to be maintained as the information table of this kernel software module creation.For fear of the information bank module in the process of handling the information request that communicates with each kernel software module; Return influencing each other in the result process to other kernel software modules; In embodiments of the present invention for the sub-thread of each kernel software module assignment only just is activated, otherwise be in suspended state when having pending information request always.Because in the information bank module is the sub-thread of each kernel software module assignment; When not having pending information request; This sub-thread is in suspended state always, therefore can effectively save the resource of information bank module, improves the work efficiency of information bank module.
S205: the sub-thread that this quilt wakes up; Take off this information table content modification request from pending request chained list; The content information to be added that carries according to this information table content modification request is to revising this content information in the information table of the first kernel software module.
S206: the sub-thread that this quilt wakes up will be finished dealing with the announcement carry on the result chained list and announce main thread and finish dealing with when writing successfully.
S207: after main thread receives announcement, take off this result, result is sent to the first kernel software module from the result chained list.
Be that example describes to carry content information to be added in this information table content modification request in the said process; In this information table content modification request, carry content information to be changed; Or content information to be deleted, or work as the kernel software module and confirm that restore data or interface data change, when the information bank module is sent information request; Its processing procedure and said process are similar, here just do not give unnecessary details one by one.
The information request that receives when the information bank module does, the second kernel software module send to the first kernel software module obtain the request of interface data the time, the communication process of software module is as shown in Figure 3 in this micro-kernel system:
S301: the main thread of information bank module receives the request of obtaining interface data to the first kernel software module that the second kernel software module is sent.
Promptly the second kernel software module is in the process of operation; Need be through carrying out information interaction with the first kernel software module; Obtain the interface data in the first kernel software module; So that when this second kernel software module can be carried out subsequent action, this second kernel software module generates this and obtains the request of interface data.
S302: the main thread of information bank module is according to being the information table of each kernel software module creation, confirms as the information of information table that this request of obtaining interface data provides this first kernel software module of information.
S303: according to the definite sub-thread that this information table is safeguarded of the information of this information table.
S304: this request of obtaining interface data is mounted on the request chained list of this information table, wakes the sub-thread that this information table is handled up.
S305: the sub-thread that this quilt wakes up, take off the request that this obtains interface data from pending request chained list, search in this information table of confirming according to this request of obtaining interface data, obtain corresponding result.
S306: the sub-thread that this quilt wakes up when getting access to corresponding result, with the corresponding result carry that gets access on the result chained list, and the announcement main thread finish dealing with.
S307: after main thread receives announcement, take off this result, this result is sent to the second kernel software module from the result chained list.
Fig. 4 for the embodiment of the invention provide when this information request for restarting when request, the communication process of software module in the micro-kernel system, this process may further comprise the steps:
S401: the main thread of information bank module receives the request of restarting that the first kernel software module is sent.
When promptly after the first kernel software module is being restarted, bringing into operation; This first kernel software module is obtained when restarting the required restore data of back operation at needs; Promptly this first kernel software module is obtained at needs and is restarted the required configuration data of back operation; When reaching the status data when before restarting, moving, generate the request of restarting, this request of restarting is sent to this information bank module.
S402: the main thread of information bank module is according to be the information table of each kernel software module creation, confirms as the information that this restarts the information table of this first kernel software module of asking to provide information.
S403: according to the definite sub-thread that this information table is safeguarded of the information of this information table.
S404: this request of restarting is mounted on the request chained list of this information table, wakes the sub-thread that this information table is handled up.
S405: the sub-thread that this quilt wakes up, take off this from pending request chained list and restart request, restart request according to this, in this information table of confirming, search, obtain corresponding result.
S406: the sub-thread that this quilt wakes up when getting access to corresponding result, with this result carry on the result chained list, and the announcement main thread finish dealing with.
S407: after main thread receives announcement, take off this result, this result is sent to the first kernel software module from the result chained list.
In embodiments of the present invention; Need move required restore data from the back of restarting that other kernel software modules are obtained when bringing into operation after the first kernel software module is restarted; All be kept at the information bank module in the information table of this first kernel software module; Therefore when this information bank module receives the request of the restarting request of first kernel software module transmission; Can be from restarting the required restore data of back operation for obtaining this this first kernel software module in the information table of this first kernel software module assignment; Since the first kernel software module obtain restart need not directly in the required restore data process of back operation and other kernel software modules to carry out direct information mutual, thereby reduced influence to other kernel software modules, improved the reliability of micro-kernel system.And because the logic of information bank module is simple, the rapid speed of process information request can also effectively improve the kernel software module and obtain the efficient that restarts required restore data, improves the speed that brings into operation after the kernel software module is restarted.
Describe below in conjunction with a concrete embodiment; The composition structural representation of a kind of micro-kernel system that Fig. 5 provides for the embodiment of the invention; Kernel software module in this micro-kernel system comprises: ROUTING module, V6 STACK module and SNMP module, and in this micro-kernel system, also comprise the information bank module.Each kernel software module in the micro-kernel system is obtained interface data at needs from extraneous module, so that when carrying out follow-up operation, all directly from the information bank module, obtain.The information bank module is the ROUTING module creation and has distributed first information table and second information table; Wherein preserve the V6 routing iinformation in the first information table, preserve the V4 routing iinformation in second information table, and safeguard this first information table and second information table through the first sub-thread; For V6 STACK module creation and distributed the 3rd information table; And safeguard the 3rd information table through the second sub-thread, for the SNMP module creation and distributed the 4th information table, and safeguard the 3rd information table through the 4th sub-thread.
Perhaps receive the announcement of Routing Protocol owing to static configuration when the ROUTING module; When confirming to have increased newly a V6 routing iinformation; The ROUTING module is sent the information table content modification request to self to the information bank module, wherein carries this V6 routing iinformation to be added in this information table content modification request.
After the main thread of information bank module receives the information table content modification request of ROUTING module transmission; The information bank module is according to the V6 routing iinformation to be added that carries in this information table content modification request, and confirming need be to operating for the first information table of this ROUTING module creation and distribution.Simultaneously because this first information table safeguards through the first sub-thread, so the information bank module with this information table content modification request carry on the request chained list of first information table, wake the first sub-thread up.
The first sub-thread that is waken up takes off this information table content modification request from the request chained list of the first information table of self maintained; With the V6 routing iinformation to be added that carries in this information table content modification request; Write in this first information table, and confirm the index of this V6 routing iinformation.The first sub-thread is carried in the result carry on the result chained list of main thread with the information of finishing dealing with when finishing dealing with, and the announcement main thread is finished dealing with.After main thread receives announcement, take off this result, this result is sent to the ROUTING module from the result chained list.
V6 STACK module is when carrying out the transmission of packet; Need communicate with the ROUTING module and obtain interface data; Promptly obtain routing iinformation, so this V6 STACK module communicates the request of obtaining interface data to the transmission of information bank module with the ROUTING module.
The main thread of information bank module receives that V6 STACK module sends communicate the request of obtaining interface data with the ROUTING module after, confirming need be to operating for this ROUTING module creation and the first information table that distributes.Simultaneously, because this first information table safeguards that through the first sub-thread information bank module on the request chained list of first information table, is waken this request carry that obtains interface data up first sub-thread.
The first sub-thread that is waken up takes off the request that this obtains interface data from the request chained list of the first information table of self maintained; Obtain the request of interface data according to this; From first information table, search routing iinformation; And with the routing iinformation carry that finds on the result chained list of main thread, and the announcement main thread finish dealing with.After main thread receives announcement, take off this routing iinformation, and send to the V6STACK module from the result chained list.
The structural representation of the communicator of software module in a kind of micro-kernel system that Fig. 6 provides for the embodiment of the invention, this device comprises:
Receiver module 61 is used to receive the information request to the first kernel software module;
Information provides module 62, is used for the information according to the information table that is directed against this first kernel software module of self preservation, in this information table, handles accordingly according to said information request, and sends result.
Said information provides module 62 specifically to be used for,
According to the information of this information table, definite sub-thread that this information table is safeguarded is handled according to said information request in this information table through said sub-thread accordingly.
Said information provides module 62 specifically to be used for,
Said information request is mounted on the request chained list of this information table; Wake the sub-thread that this is confirmed up; Through the said sub-thread that wakes up; In this information table, handle accordingly, receive the announcement that said sub-thread sends, take off the result of said sub-thread carry on the result chained list and transmission according to said information request.
Said information provides module 62 specifically to be used for, and when said information request is the request of information table content modification, according to the request of said information table content modification, revises this information table through said sub-thread.
Said information provides module 62 specifically to be used for, when said information request for restarting when request, according to said restart information request, search in said information table through said sub-thread and to restart the required restore data of back operation.
Said information provides module 62 specifically to be used for, when said information request for when the first nuclear kernel software module is obtained the request of interface data, according to said request of obtaining interface data, in said information table, search said interface data through said sub-thread.
Said device also comprises:
Create module 63, be used for, create at least one information table, wherein preserve information that produces in this kernel software module operational process and required information in the operational process in this information table to each kernel software module according to each first kernel software module.
In the said device,
Said receiver module 61 also is used for, and receives the first kernel software module when definite restore data interface data changes, and the information request to the first kernel software module of transmission is wherein carried restore data or interface data after the variation in this information request; Or, when receiving the first kernel software module and after restarting, bringing into operation, send information request to the first kernel software module; Or, in the second kernel software module when confirming to call the interface data of the first kernel software module, the information request to the first kernel software module of transmission.
The embodiment of the invention also provides a kind of micro-kernel system, and said system comprises communicator, the first kernel software module and the second kernel software module of software module in the above-mentioned micro-kernel system.
The embodiment of the invention provides a kind of routing device, and said routing device comprises above-mentioned described micro-kernel system.
The embodiment of the invention provides communication means, system and the device of software module in a kind of micro-kernel system; In this method; When needs are operated the first kernel software module, send information request to the information bank module, the information of the information table of preserving according to self that is directed against the first kernel software module to the first kernel software module; In this information table, carry out handled, and send the announcement of finishing dealing with according to this information request.Owing in the information bank module, all be provided with corresponding information table in embodiments of the present invention to each kernel software module; In this information table, handle accordingly to this information request; Therefore other kernel software modules need not to obtain corresponding information alternately with the first kernel software module again; Thereby reduced the degree of coupling between the kernel software module in the micro-kernel system, reduced the performance of kernel software module when carrying out the corresponding information operation and descended.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, belong within the scope of claim of the present invention and equivalent technologies thereof if of the present invention these are revised with modification, then the present invention also is intended to comprise these changes and modification interior.