Fault-tolerant computer system data comparing method serving operating system core layer
Technical Field The invention belongs to the field of computer, relates to the computer fault-tolerant technology and data comparison of the technical, in particular to a service of the operating system kernel layer fault-tolerant computer system data comparison method. Background Art As the computer, the rapid development of the Internet technology, the information technology has in all aspects of Society, computer technology in the context of improving the work efficiency, to facilitate the exchange of information in the greatly changed the way of life of people, but at the same time, also gives to the reliance on produce more and more, a fault of the computer system may bring about loss of immeasurable. For those who need to safeguard information security and provide uninterrupted body of information service, such as the securities, manufacturing, communication, bank, transportation, operational reliability of the system and it is particularly important to the discontinuity. How to improve the reliability and availability of the computer system, thereby protecting the various key application ongoing operation, achieve sustainable operating a virtuous cycle, the field of information has become an important issue. Fault-tolerant computer and related technology it is in this kind of objective demand emerged, can be avoided by using fault-tolerant computer caused because the server failure of the tens of thousands of the economic loss. Fault-tolerant computer is in the redundant resources (hardware redundancy, temporal redundancy, information redundancy, software redundancy) on the basis of, of the system structure by the reasonable designed, the effective management of the system software is formed under a high reliability, high availability computer. Fault detection of fault-tolerant computer system is one of the key technologies, the task data to compare to, vote is the primary means of error found. A comparison of the data, based on a vote based on software and hardware in two ways. Hardware-based method in comparison to increase in the system in the chip, chip comprises a comparison or voting logic, the written data is compared to the fabrication, vote, this way of discovering erroneous timely, but complicated design, realize the high cost. The method of software-based application program or library function set up the more, vote point, the task of the intermediate result and the final output consistency judgment, this way system is of simple design, but poor transparency for the application, and for programming personnel additional burden on users. Content of the invention The purpose of this invention lies in the shortcoming and deficiency of the prior art, provides a service of the operating system kernel layer fault-tolerant computer system data comparison method, the invention can be to the fault-tolerant system in the state of the redundant task results and data consistency comparison, redundant task of recording at the same time synchronous comparison information. In order to achieve the above-mentioned tasks, the invention adopts the following technical solution: in the Linux operating system kernel ft_syner creating kernel state shugo process, the implementation of the comparator logic, for the redundant process data comparing services provided; in the implementation of the process of the write operation, the write data are to be prepared, then the main process will wait to write data encapsulation for news, then the message by adding redundant process and bao Tian data comparator communication channel, and active wake-up data comparator ft_syner for data comparison, the data comparator ft_syner after the data comparison is completed, the redundant process in the bag through the detection message field to obtain the result of the comparison result of the comparison. The communication channel, to realize the following manner: in the Linux operating system kernel ft_syner_event_list establish the incident list, redundant process and the data comparator realizing communication ft_syner_event_list through the event list. Data comparator and redundant process to survivors-consumer manner, redundant process data to be compared according to the protocol format of the message packets in the linked list in the event ft_syner_event_list, comparator ft_syner_event_list from the event message packets in the linked list, extracting data information from the comparison. The format of the message packet to: Typedef struct{ Struct list_head list; Ft_msg_type short; Struct task_struct* p1; Struct task_struct* p2; Void*master_data; Master_data_len long; Void*slave_data; Slave_data_len long; Short error; } Ft_syner_event_msg; Wherein, the list chain meter , for delivery of the message packet in the event list, the Linux kernel list_head universal link list structure is, news insertion, use the kernel in the delete operation () and list_del list_add complete (); Ft _msg_type as the message type, message packets that a kind of system call from which, the specific value is defined as follows: FT_WRITE #define 1 // write () system call FT_WRITEV #define 2 // writev () system call FT_SEND #define 3 // send () system call FT_SENDTO #define 4 // sendto () system call FT_SENDMSG #define 5 // sendmsg () system call Comparator, according to the value of the message type ft_msg_type determining whether message packet from which it is generated on a kind of system call, the above definition can be extended or reduced according to the needs; P1, p2 to produce redundant process the message packet to the process control block pointer, p1 main process, p2 as from process, the comparator through the two pointers of the redundant process to obtain process control block; Master_data to be redundant process in the main process to a data buffer pointer, the buffer length is master_data_len; The redundant process is slave_data from the process in a data buffer pointer, the length of the buffer zone slave_data_len; Error recording the result of the comparison, value is 1 indicating that the data is consistent, value is 0 indicating that the data is not consistent. The data comparator, the Linux operating system kernel is created in one of the kernel state daemons ft_syner, it the permanent operating system kernel, the implementation of the comparator logic, for the redundant process providing data compares the service. The kernel state daemons ft_syner idle time is in a wait state, a task can be the wake-up process, or its own periodic wake-up, the kernel state shugo process is awakened each time after ft_syner, ft_syner_event_list traverse event linked list, the linked list of parsing a message packet, and compare data. Analyzing the end of the current event list after all of the message packet, the kernel state shugo process invoking function ft_syner sleep_on_timeout enter the waiting state (), this function is set in the waiting period is 5 seconds, the waiting time of the wake-up after ft_syner nucleate shugo process traverse into the next round. The redundant process requires the main from the attribute, in the implementation of the process of the write operation, the write data are to be prepared, then the main process will wait to write data encapsulation for a message packet, through list_add (& (msg-> list), & ft_syner_event_list) the message ft_syner_event_list bao Tian addition event linked list, and active wake-up the ft_syner nucleate shugo process, nucleate shugo process, after comparing ft_syner complete data, redundancy process can be through measuring msg-> error to obtain the result of the comparison. In the data comparator of the present invention provided in the form of a kernel shugo process service data comparison, redundant process in the write () call, writev (), send (), () sendto, sendmsg the write operation of the associated (), the data in the service finish the operation of the comparator to compare the write data. That is, the Linux operating system kernel shugo process starting in ft_syner, the process to execute data comparator logic, fault-tolerant computer system is in dual-mode redundancy process of providing data compares the service. Kernel ft_syner_event_list added in the linked list of events as a message channel, redundant process and the data comparator in order to produce the-consumer manner, redundant process will wait to write data encapsulation for a message packet is inserted into the message linked list, taken from the message list of the comparator, and parse a message for data comparison is completed, the final redundant process to return the result. This invention is in the kernel layer of the operating system is by way of software, reliable dual-mode of the complete redundant fault-tolerant system of data comparison of the process. The method for implementing the kernel layer of the operating system, no hardware customization, based on universal hardware structure suitable for the process of a dual-mode redundancy fault-tolerant system level, all logic in the operating system kernel layer automatically complete, there is no need to participate in the application program, the application has good transparency. Description of drawings Figure 1 of this invention the work of the data comparator in the flow chart; Figure 2 the redundant process for this invention with the data in the interactive schematic diagram of the comparator. Mode of execution Combined with the Figure below the further detailed description of this invention. The method of the present invention are as follows: In the Linux operating system kernel ft_syner creating kernel state shugo process, the implementation of the comparator logic, for the redundant process data comparing services provided; in the implementation of the process of the write operation, the write data are to be prepared, then the main process will wait to write data encapsulation for news, then the message by adding redundant process and bao Tian data comparator communication channel, and active wake-up data comparator ft_syner for data comparison, the data comparator ft_syner after the data comparison is completed, the redundant process in the bag through the detection message field to obtain the result of the comparison result of the comparison. The communication channel, to realize the following manner: in the Linux operating system kernel ft_syner_event_list establish the incident list, redundant process and the data comparator realizing communication ft_syner_event_list through the event list. Data comparator and redundant process to survivors-consumer manner, redundant process data to be compared according to the protocol format of the message packets in the linked list in the event ft_syner_event_list, comparator ft_syner_event_list from the event message packets in the linked list, extracting data information from the comparison. The format of the message packet to: Typedef struct{ Struct list_head list; Ft_msg_type short; Struct task_struct* p1; Struct task_struct* p2; Void*master_data; Master_data_len long; Void*slave_data; Slave_data_len long; Short error; } Ft_syner_event_msg; Wherein, the list chain meter , for delivery of the message packet in the event list, the Linux kernel list_head universal link list structure is, news insertion, use the kernel operation in register list_add list_del of () and finish (); Ft _msg_type as the message type, message packets that a kind of system call from which, the specific value is defined as follows: FT_WRITE #define 1 // write () system call FT_WRITEV #define 2 // writev () system call FT_SEND #define 3 // send () system call FT_SENDTO #define 4 // sendto () system call FT_SENDMSG #define 5 // sendmsg () system call Comparator, according to the value of the message type ft_msg_type determining whether message packet from which it is generated on a kind of system call, the above definition can be extended or reduced according to the needs; P1, p2 to produce redundant process the message packet to the process control block pointer, p1 main process, p2 as from process, the comparator through the two pointers of the redundant process to obtain process control block; Master_data to be redundant process in the main process to a data buffer pointer, the buffer length is master_data_len; The redundant process is slave_data from the process in a data buffer pointer, the length of the buffer zone slave_data_len; Error recording the result of the comparison, value is 1 indicating that the data is consistent, value is 0 indicating that the data is not consistent. The data comparator, the Linux operating system kernel is created in one of the kernel state daemons ft_syner, it the permanent operating system kernel, the implementation of the comparator logic, for the redundant process providing data compares the service. The kernel state daemons ft_syner idle time is in a wait state, a task can be the wake-up process, or its own periodic wake-up, the kernel state shugo process is awakened each time after ft_syner, ft_syner_event_list traverse event linked list, the linked list of parsing a message packet, and compare data. Analyzing the end of the current event list after all of the message packet, invoking function ft_syner sleep_on_timeout enter the waiting state (), this function is set in the waiting period is 5 seconds, after the waiting time of the wake-up ft_syner traverse into the next round. The redundant process requires the main from the attribute, in the implementation of the process of the write operation, the write data are to be prepared, then the main process will wait to write data encapsulation for a message packet, through list_add (& (msg-> list), & ft_syner_event_list) the message ft_syner_event_list bao Tian addition event linked list, and active wake-up data comparator ft_syner, in the data comparator ft_syner after the data comparison is completed, the redundant process can be through measuring msg-> error to obtain the result of the comparison. Figure 1 of the comparator shown in the process of work data: (1) comparator process () call ft_syner spin_lock spin lock of the link table acquisition message; (2) determining whether message linked list is null ft_syner_event_list, if is in the idle (6), if not is in the idle (3); (3) obtain list msg one of the message packet, parsing the message packet and complete the data comparison; (4) the use of () kernel list_add the processing end of the message packet is deleted from the message linked list; (5) if the message list are not processing the remaining message packet, transfer (3), or turning to (6); (6) call release message () spin_unlock spin lock of the link table; (7) a comparator process () call ft_syner sleep_on_timeout enter the sleep waiting; (8) process the ft_syner after the waiting time period the dynamic wake-up, or redundant process active wake-up; (9) finish judgement flag bit, if the finish to 1, said comparator receiving the request of the service to the end, end ft_syner, if the finish is 0, rotary (1) into the next round of services. Figure 2 showing the redundant process interactive process with the data of the comparator. The chart to write () operation, for example, redundant process P1, P2 in the implementation of the write operation () the need for data comparison, redundant process will wait to compare data encapsulated in the message packet in msg, and inserted into the message linked list, wake-up data comparator. Comparator from message packets in the message list, analyze the message packet is defined according to the form, and the two portions of the packet data in the consistency comparison, the result of the comparison is stored in the msg-> in error. By examining the final redundant process msg-> obtaining the result of the comparison the value of the error. The invention relates to a fault-tolerant computer system data comparing method serving an operating system core layer. The data comparing service is provided for a double-module redundancy process in a fault-tolerant computer system by starting a core daemon process in a Linux operating system and executing data comparator logics. An event list is added in a core to be used as a message passage;the redundancy process and a data comparator are operated in a production-consumption way; the redundancy process packages the data to be written into a message packet to be inserted into a message list; and the comparator takes the message packet from the message list, analyzes the message packet according to a definition format, compares the data to be written of the redundancy process and finally returns a result to the redundancy process. The invention is realized in the operating system core layer, has no customized hardware, simple realization and good generality and is suitable for a process-grade double-module redundancy fault-tolerant system based on a common hardware structure. All comparing logics are automatically finished in the operating system core layer without participation of an application program and have favorable transparency on application. 1. Service for fault-tolerant computer system kernel layer of the operating system data comparison method, characterized in that first of all in the Linux operating system kernel ft_syner creating kernel state shugo process, its role in the implementation of the comparator logic, providing the data for a redundant process; secondly when the redundant process in the implementation of the write operation to be prepared respectively in the process after the data writing, the main process will be encapsulated into these to be the write data of the message and the message packets bao Tian adding redundant process and the data comparator in the communication channel, at the same time data comparison wake-up data comparator; the last data comparator completion of data comparison, redundant process in the bag through the detection message field to obtain the result of the comparison result of the comparison; the communication channel, to realize the following manner: in the Linux operating system kernel ft_syner_event_list establish the incident list, redundant process and through the event list data comparator realizing communication ft_syner_event_list; data comparator and redundant process to survivors-consumer manner, redundant process data to be compared according to the protocol format of the message packets in the linked list in the event ft_syner_event_list, comparator from the event message packets in the linked list ft_syner_event_list and extracting data information from the comparison; the data comparator, the Linux operating system kernel is created in one of the kernel state daemons ft_syner, it the permanent operating system kernel, the implementation of the comparator logic, providing the data for a redundant process, the kernel state daemons ft_syner idle time is in a wait state, redundant process a task when the wake-up, or its own periodic wake-up, the kernel state shugo process is awakened each time after ft_syner, ft_syner_event_list traverse event linked list, the linked list of parsing a message packet, and compare data, analyzing the end of the current event list after all of the message packet, the kernel state shugo process invoking function ft_syner sleep_on_timeout enters the wait state, in this function in the set the latency period is 5 seconds, the waiting time of the wake-up after ft_syner nucleate shugo process traverse into the next round; the main process to the redundant from the attribute, in the implementation of the process of the write operation, the write data are to be prepared, then the main process will wait to write data encapsulation for a message packet, the message through the function list_add ft_syner_event_list bao Tian addition event linked list, and active wake-up the ft_syner nucleate shugo process, nucleate shugo process, after comparing the data ft_syner, redundant process msg obtained by detecting the value of the result of the comparison.