CN100433011C - Under embedded environment, method for protecting consistency of memory database - Google Patents

Under embedded environment, method for protecting consistency of memory database Download PDF

Info

Publication number
CN100433011C
CN100433011C CNB2006100112089A CN200610011208A CN100433011C CN 100433011 C CN100433011 C CN 100433011C CN B2006100112089 A CNB2006100112089 A CN B2006100112089A CN 200610011208 A CN200610011208 A CN 200610011208A CN 100433011 C CN100433011 C CN 100433011C
Authority
CN
China
Prior art keywords
database
database manipulation
interface
manipulation
message
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.)
Active
Application number
CNB2006100112089A
Other languages
Chinese (zh)
Other versions
CN101004742A (en
Inventor
袁越
蒋恒
陈浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zhigu Tech Co Ltd
Original Assignee
ZTE Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CNB2006100112089A priority Critical patent/CN100433011C/en
Publication of CN101004742A publication Critical patent/CN101004742A/en
Application granted granted Critical
Publication of CN100433011C publication Critical patent/CN100433011C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method for maintaining consistency of internal memory databank under embedded environment includes using application process with the same priority as databank process to call on the first type of interface of databank and directly finalizing databank operation by calling on functional interface function of databank operation, calling on the second type of interface by the other application process and sending databank access request message to databank operation process then calling on said interface function to finalize databank operation according to said request message.

Description

The method for protecting consistency of memory database under the embedded environment
Technical field
The present invention relates to a kind of transaction management technology of memory database, particularly, is a kind of in embedded system, under the strategy of process based on the priority preemptive schedule, guarantees the conforming method of memory database operation.
Background technology
The memory database technology is as the real-time data base technology under a kind of embedded environment, need be used widely the field that business is made real-time response many, as fields such as telecommunications, controls.Memory database means that all or most data all leave in the internal memory, thereby has avoided the expense of disk read-write, so data access speed improves greatly.The design idea of disk database so the design of real-time internal memory database need break traditions, consider the characteristics of the direct quick access of internal memory, efficiently be utilized as strategy, algorithm and the mechanism that target redesigns the various database manipulations of exploitation with CPU and memory headroom.
Each process all has a priority in the system, and the process of high priority can be grabbed operation usually, real-time data base is a shared resource, if the visit of these processes is not controlled, possibly because this operating system cause the process mistake based on the seizing scheduling strategy of priority read or store data, destroy the consistance of data, so, in the real-time dataBase system, must take good consistance safeguard.To this, the general mode that locks that adopts of traditional database, for example in certain process before database is carried out write operation, must obtain to monopolize locking.Send monopolize locking after, other read or write will can not take place again.
Because memory database runs on internal memory, disk read-write no longer is the low bottleneck of system performance, and locking becomes the main expense of system operation.Complicated lock mechanism can cause very important influence to the affairs travelling speed undoubtedly, and the hidden danger of deadlock and interlocking also can reduce the reliability of system greatly.
Summary of the invention
The objective of the invention is to, in embedded system,, provide a kind of method for protecting consistency of memory database, realize the low expense of system resource and the high-level efficiency of service based on the seizing under the scheduling strategy of priority.
To achieve these goals, the invention provides the method for protecting consistency of memory database under a kind of embedded environment, one group of database application process is hereinafter to be referred as database process, the priority of database process is all identical, other application processes identical with database process priority are designated hereinafter simply as first kind application process, the process inequality with database process priority is designated hereinafter simply as the second class application process, wherein first kind application process is called the first kind interface of database, calls corresponding database operating function interface function by event number and directly finishes database manipulation; The second class application process is called second class interface of database, send the corresponding database access request message by event number to the database manipulation process, and call corresponding database operating function interface function by the database manipulation process according to the database access request message and finish database manipulation.
The method for protecting consistency of memory database under the above-mentioned embedded environment; wherein; after database was finished database manipulation, first kind interface returned to first kind application process with the data structure of return results by output parameter, and second class interface returns to the second class application process with response message.
The method for protecting consistency of memory database under the above-mentioned embedded environment, wherein, the step that first kind application process is finished database manipulation by first kind interface specifically comprises:
Step 101, first kind application process are called first kind interface primitive, and input parameter comprises the data structure of the output parameter of the input parameter value of event number, database manipulation of database manipulation and database manipulation;
Step 102, whether the event number of judgment data storehouse operation is legal, if illegal, then arrives step 104, directly returns; If it is legal then enter step 103 and continue to carry out;
Step 103 is called associated databases operating function interface function according to the event number of database manipulation and is carried out database manipulation, and for returning first kind application process behind the variable assignments in the output parameter data structure.
The method for protecting consistency of memory database under the above-mentioned embedded environment, wherein, the step that the second class application process is finished database manipulation by second class interface specifically comprises:
Step 201, application process are called the second class interface primitive, and input parameter comprises the output parameter data structure of database manipulation event number, database manipulation input parameter value and database manipulation;
Step 202, whether the event number of judgment data storehouse operation is legal, if illegal, then directly returns; Otherwise entering step 203 continues to carry out;
Step 203, call corresponding forwards function according to the event number of database manipulation and send the database manipulation request message to the database manipulation process, the database manipulation request message comprises database manipulation message number, the input parameter value of request, the data structure of output parameter;
Step 204, function call finishes, and returns;
Step 301, database manipulation process process database operations request message;
Step 302 judges whether message number is legal, if illegal, then arrives step 305, if legal then enter step 303;
Step 303 according to given message number, is called corresponding database operating function interface function and is carried out database manipulation, and is each variable assignments in the output parameter data structure, and sends response message for the originating process of initiating to call specifically;
Step 304, function returns, and the call flow of second class interface is finished fully;
Step 305 abandons this message, directly returns.
The method for protecting consistency of memory database under the above-mentioned embedded environment; wherein; in the described step 201; the second class application process is called the second class interface primitive by the synchronization message mode and is then hung up the second class application process, if call the second class interface primitive by the asynchronous message mode then enter step 202.
The method for protecting consistency of memory database under the above-mentioned embedded environment, wherein, described database manipulation carries out data access, renewal, interpolation or deletion by database manipulation functional interface function by input parameter in database.
Compared with prior art, the present invention is process seizing under the scheduling strategy based on priority, the access interface of form unanimity is provided to other processes, what adopt is low expense, high efficiency message mechanism, rather than the locking method of the complexity of common consumes resources, thereby simplified the design of data base consistency(-tance) support method, guaranteed the performance of memory database system.
Description of drawings
Fig. 1 is the invoked procedure process flow diagram of first kind interface;
Fig. 2 is the interface function invoked procedure process flow diagram of second class interface;
Fig. 3 is the process flow diagram of second class interface fulfillment database operation;
Fig. 4 is the process switching and the message transmitting process synoptic diagram of different priorities.
Embodiment
One group of process of memory database itself is referred to as database process, has consistent process priority, other application processes are undertaken by the standard interface that database provides access of database, in the method for the present invention, the standard interface of database module is divided into two class interfaces: first kind interface is only for calling with the application process of the database process level that has that All factors being equal, preference will be give to; Second class interface for and the application process accessing database of database process different priorities use, both comprised high priority, also comprise low priority.
The first kind interface and second class interface have accordant interface primitive and call form, are mapped to certain function by event number, and the required input parameter of the functional definition that provides according to data-interface and the data structure of output parameter.
First kind interface function encapsulation be actual database manipulation power function, the encapsulation of the second class interface function be the forwards function, send the database access request message to the database manipulation process.
First kind process is initiated database manipulation by the primitive that calls first kind interface function, this interface primitive calls database manipulation functional interface function by event number and directly finishes database manipulation, and return results is returned by the data structure of output parameter.
The second class application process is initiated database manipulation by the primitive that calls second class interface, this interface primitive is transmitted function by the event number message call, the unactual database manipulation that carries out of this function, but send the corresponding database access request message to the database manipulation process, the content of database access request message comprises event number, the input parameter data structure.After the database manipulation process is received the database manipulation request message, forward in the database manipulation functional interface function by event number is diffusing, carry out database manipulation, finish back transmission response message to the application process of calling this database interface primitive, the content of this response message comprises event number, the output parameter data structure.
Simultaneously in order to improve the dirigibility of Application of Interface, second class interface provides two kinds of access modes: synchronization message mode and asynchronous message mode, and specifically use which kind of mode can be given in the input parameter data structure of interface.
As shown in Figure 1, the invoked procedure of first kind interface is as described below:
When first kind process need be called database manipulation, embodiments of the invention carry out according to following standard interface: dbCall (EventNo, iParam, oParam), wherein EventNo provides the event number of this database manipulation that calls, input parameter, the oParam that iParam is database manipulation is the data structure of the output parameter of database manipulation.
As shown in Figure 1, the invoked procedure of first kind interface comprises the steps:
Step 101, first kind application process are called first kind interface primitive, and input parameter comprises the event number of the database manipulation that this calls, the data structure of the input parameter value of database manipulation and the output parameter of database manipulation;
Step 102, whether decision event is number legal, if illegal, then arrives step 104, directly returns; If it is legal then enter step 103 and continue to carry out;
Step 103, event number according to database manipulation calls the database manipulation that associated databases operating function interface function carries out reality, database manipulation functional interface function carries out operations such as data access, renewal, interpolation or deletion by the input parameter value in database, and is each variable assignments in the output parameter data structure;
Step 104, function returns, and finishes the call flow to first kind interface.
As shown in Figure 2, the interface function invoked procedure of second class interface is as described below:
When the second class application process more high or low than database manipulation priority called database manipulation, present embodiment provides following standard interface: dbAccess (EventNo, iParam, oParam), wherein EventNo provides the event number of this database manipulation that calls, input parameter, the oParam that iParam is database manipulation is the data structure of the output parameter of database manipulation, and having a member msgtype to indicate this message in the iParam structure simultaneously is synchronization message or asynchronous message.
As shown in Figure 2, the forwards function calls process of second class interface comprises the steps:
Step 201, the second class application process is called the second class interface primitive, and input parameter comprises the data structure of the output parameter of the input parameter value of event number, database manipulation of the database manipulation that this calls and database manipulation;
Step 202, whether decision event is number legal, if illegal, then arrives step 204, directly returns; If it is legal then enter step 203 and continue to carry out;
Step 203, according to given event number, call corresponding forwards function and send the database manipulation request message to the database manipulation process, this request message comprises following parameter: the database manipulation event number of being asked, comprise to indicate and use synchronously or the input parameter value of asynchronous message type, the data structure of output parameter.
Step 204, function returns, and finishes the forwards function calls flow process to second class interface.
As shown in Figure 3, the database manipulation process function call flow in second class interface is as follows:
Standard interface in the present embodiment is: pZDB_ACCESS (MsgId, Msg_iparam, Msg_oparam), wherein message number MsgId unique identification this message database manipulation of asking, consistent with the EventNo in the interface function, Msg_iparam is consistent with iParam and oParam in second class interface language respectively with the Msg_oparam structure.
As shown in Figure 3, the function treatment scheme comprises the steps:
Step 301, the database manipulation process begins the process database operations request message, and the process input parameter comprises message number, input parameter value and output parameter data structure;
Step 302 judges whether message number is legal, if illegal, then arrives step 305, if legal then enter step 303;
Step 303, according to given message number, call corresponding database operating function interface function and carry out actual database manipulation, database manipulation functional interface function carries out operations such as data access, renewal, interpolation or deletion by the value of input parameter in database, be each variable assignments in the output parameter data structure, and send response message for the originating process of initiating to call specifically, response message comprises following parameter: the database manipulation event number of this time execution, the input parameter value that comprises synchronous or asynchronous message, the value of output parameter, originating process;
Step 304, function returns, and the call flow of second class interface is finished fully;
Step 305 abandons this message, directly returns.
Based on the seizing under the scheduling strategy of process priority, the process of high priority guarantees that by calling second class interface conforming disposal route of memory database specifically may further comprise the steps in operating system in the present invention:
Step 1, high priority process A calls the second class interface primitive, and current database operation process B hangs up, the legitimacy of the second class interface call function decision event number, if legal, call subfunction and send the particular data access request message in the message queue of database access process P; If illegal, return wrong back and finish; If the synchronization message mode, then A hangs up, if the asynchronous message mode, then process A continuation operation is finished;
Step 2 because process P and B are in same priority, do not exist and seizes, and continues the B process that is suspended in the treatment step 1 behind A hang-up or the end of run;
Step 3, after the B process disposes, the message queue of operating system scan database process, the processing messages of acquisition P process;
Step 4 begins to carry out the function of database access process P, if the event number that message is given is legal, then loosing forwards database manipulation functional interface function to, carries out database manipulation, if illegal, directly abandon invalid message and finishes;
Step 5, the interface function function is finished, and sends echo reply message to the process A that initiates this operation.
As shown in Figure 4, the process switching of different priorities and message transmitting process are as follows:
In this embodiment, process A priority is higher than database manipulation, has the ability of grabbing database manipulation, and process B priority and database manipulation are equal to, and process P mentions the database access process above being.So three process priority situations are: process A>process B=process P.
In the T1 moment, database process B is carrying out the database access operation;
In the T2 moment, process A need operate database, calls the dbAccess interface, because A priority is higher than database manipulation, then this moment, the B process was suspended;
T3 constantly, the dbAccess interface sends database manipulation request message REQ in the message queue of process P, if what process A sent is synchronization message, then process A is suspended at this moment, if asynchronous message, then process A continues down to carry out (shown in empty arrow among the figure), and level that the process B that process P and T2 are suspended constantly has that All factors being equal, preference will be give to is so continue execution B process;
In the T4 moment, process B is finished, and operating system scans the message of process P, begins to carry out database access process P;
The T5 moment: the database access process P that is caused by process A is finished, and return to A response message ACK, process A receives response message, if T3 constantly, what process A sent is synchronization message, then this moment, process A can become executing state by suspended state, and the data base call operation of process A is finished.
Equally, priority is lower than the application process of database process, call database manipulation request corresponding behind second class interface, send in the database manipulation process as message, because database manipulation process and other database process same priorities, so operating process can not interrupted by other database processes, so calling the high still low practical operation to database of priority of the application process of second class interface all is to finish in the database manipulation process, can not cause database to be reentried.
Certainly; the present invention also can have other various embodiments; under the situation that does not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art work as can make various corresponding changes and distortion according to the present invention, but these corresponding changes and distortion all should belong to the protection domain of the appended claim of the present invention.

Claims (6)

1, the method for protecting consistency of memory database under a kind of embedded environment is characterized in that:
Call the first kind interface of database with the first kind application process of the database process level that has that All factors being equal, preference will be give to, call corresponding database operating function interface function by event number and directly finish database manipulation;
The second class application process different with database process priority called second class interface of database, send the corresponding database access request message by event number to the database manipulation process, and call corresponding database operating function interface function by the database manipulation process according to the database access request message and finish database manipulation.
2, the method for protecting consistency of memory database under the embedded environment according to claim 1; it is characterized in that; after database is finished database manipulation; first kind interface returns to first application process with the data structure of return results by output parameter, and second class interface returns to second application process with response message.
3, the method for protecting consistency of memory database under the embedded environment according to claim 2 is characterized in that the step that first kind application process is finished database manipulation by first kind interface specifically comprises:
Step 101, application process are called first kind interface primitive, and input parameter comprises the data structure of the output parameter of the input parameter value of event number, database manipulation of the database manipulation that this calls and database manipulation;
Step 102, whether the event number of judgment data storehouse operation is legal, if illegal, then arrives step 104, directly returns; If it is legal then enter step 103 and continue to carry out;
Step 103 is called associated databases operating function interface function according to the event number of database manipulation and is carried out database manipulation, and for returning first application process behind the variable assignments in the output parameter data structure.
4, the method for protecting consistency of memory database under the embedded environment according to claim 2 is characterized in that, the step that the second class application process is finished database manipulation by second class interface specifically comprises:
Step 201, application process are called the second class interface primitive, and input parameter comprises the output parameter data structure of this database manipulation event number that calls, database manipulation input parameter value and database manipulation;
Step 202, whether the event number of judgment data storehouse operation is legal, if illegal, then directly returns; Otherwise entering step 203 continues to carry out;
Step 203, call corresponding forwards function according to the event number of database manipulation and send the database manipulation request message to the database manipulation process, the database manipulation request message comprises database manipulation message number, the input parameter value of request, the data structure of output parameter;
Step 204, function call finishes, and returns;
Step 301, database manipulation process process database operations request message;
Step 302 judges whether message number is legal, if illegal, then arrives step 305, if legal then enter step 303;
Step 303 according to given message number, is called corresponding database operating function interface function and is carried out database manipulation, and is each variable assignments in the output parameter data structure, and sends response message for the originating process of initiating to call specifically;
Step 304, function returns, and the call flow of second class interface is finished fully;
Step 305 abandons this message, directly returns.
5, the method for protecting consistency of memory database under the embedded environment according to claim 4; it is characterized in that; in the described step 201; call the second class interface primitive by the synchronization message mode then hang up the second class application process if be higher than the second class application process of database manipulation process when priority, if call the second class interface primitive by the asynchronous message mode then enter step 202.
6, according to the method for protecting consistency of memory database under claim 3 or the 4 described embedded environments; it is characterized in that described database manipulation is specially: database manipulation functional interface function carries out data access, renewal, interpolation or deletion by input parameter in database.
CNB2006100112089A 2006-01-17 2006-01-17 Under embedded environment, method for protecting consistency of memory database Active CN100433011C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100112089A CN100433011C (en) 2006-01-17 2006-01-17 Under embedded environment, method for protecting consistency of memory database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100112089A CN100433011C (en) 2006-01-17 2006-01-17 Under embedded environment, method for protecting consistency of memory database

Publications (2)

Publication Number Publication Date
CN101004742A CN101004742A (en) 2007-07-25
CN100433011C true CN100433011C (en) 2008-11-12

Family

ID=38703887

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100112089A Active CN100433011C (en) 2006-01-17 2006-01-17 Under embedded environment, method for protecting consistency of memory database

Country Status (1)

Country Link
CN (1) CN100433011C (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156700A (en) * 2010-02-12 2011-08-17 华为技术有限公司 Database accessing method and device and system
CN103067204B (en) * 2012-12-25 2017-08-04 上海斐讯数据通信技术有限公司 A kind of method that OMCI entities are accessed from application layer
CN103731752A (en) * 2013-11-28 2014-04-16 乐视致新电子科技(天津)有限公司 Method and device for setting overall image quality of smart television
CN104516964B (en) * 2014-12-24 2018-06-08 北京奇虎科技有限公司 The generation method of database function interface, the processing method and processing device of onboard data
CN106155774A (en) * 2015-04-23 2016-11-23 中兴通讯股份有限公司 Event-handling method, Apparatus and system
CN105068877B (en) * 2015-07-14 2018-07-17 许继电气股份有限公司 Data consistency transmission method between a kind of multipriority task
CN108363741B (en) * 2018-01-22 2021-01-26 中国平安人寿保险股份有限公司 Big data unified interface method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010049074A (en) * 1999-11-30 2001-06-15 서평원 System and Method of Controlling Management and Maintenance of Process
KR20020030223A (en) * 2000-10-16 2002-04-24 주식회사 알라딘소프트 Logging and recovery method for supporting high performance transaction in main memory resident database system
KR20030072426A (en) * 2002-03-04 2003-09-15 포인트아이 주식회사 The method of real-time location tracking process using main memory dbms and reservation execution function
CN1645372A (en) * 2005-02-25 2005-07-27 中兴通讯股份有限公司 Universal constraining realizing method for real-time internal memory database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010049074A (en) * 1999-11-30 2001-06-15 서평원 System and Method of Controlling Management and Maintenance of Process
KR20020030223A (en) * 2000-10-16 2002-04-24 주식회사 알라딘소프트 Logging and recovery method for supporting high performance transaction in main memory resident database system
KR20030072426A (en) * 2002-03-04 2003-09-15 포인트아이 주식회사 The method of real-time location tracking process using main memory dbms and reservation execution function
CN1645372A (en) * 2005-02-25 2005-07-27 中兴通讯股份有限公司 Universal constraining realizing method for real-time internal memory database

Also Published As

Publication number Publication date
CN101004742A (en) 2007-07-25

Similar Documents

Publication Publication Date Title
CN100433011C (en) Under embedded environment, method for protecting consistency of memory database
EP2871809B1 (en) Message processing method, device and system for internet of things
JP5516398B2 (en) Multiprocessor system and method for sharing device between OS of multiprocessor system
CN110134534B (en) System and method for optimizing message processing for big data distributed system based on NIO
CA2600503C (en) Method and system for executing a container-managed application on a processing device
US7526673B2 (en) Parallel processing system by OS for single processors and parallel processing program
US9110715B2 (en) System and method for using a sequencer in a concurrent priority queue
CN105187327A (en) Distributed message queue middleware
US6907606B1 (en) Method for implementing event transfer system of real time operating system
CN111209123A (en) Local storage IO protocol stack data interaction method and device
CN104408110A (en) Method, device and system for requesting data
CA2332586A1 (en) A telecommunication controller messaging system
JPH09511858A (en) Parallel execution of requests in OSI agent
CN111949422A (en) Data multi-level caching and high-speed transmission recording method based on MQ and asynchronous IO
CN104219284A (en) Server designing method based on semi-synchronization, semi-synchronization and pipe filter mode
JP3908589B2 (en) Communication system, connection management server device, and program
CN101295269B (en) Component interactive synchronization method based on transaction
CN100337228C (en) Time-out adaptive method in remote synchronous calling procedure
CN100488128C (en) A dynamic modification method and system of parameters of client service system
Aldred et al. Understanding the challenges in getting together: The semantics of decoupling in middleware
CN109784045A (en) Dual system communications access control method and computer readable storage medium
CN112749020A (en) Microkernel optimization method of Internet of things operating system
KR101429884B1 (en) Hashing method for distributed data processing to process high-speed network massive traffic processing and hashing system for distributed data processing
KR101029788B1 (en) Method for delivering message between layers of middleware and computer readable medium recording program for performing the method
Yeung et al. A new deadlock detection algorithms for distributed real-time database systems

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
ASS Succession or assignment of patent right

Owner name: BEIJING Z-GOOD TECHNOLOGY SERVICE CO., LTD.

Free format text: FORMER OWNER: ZTE CORPORATION

Effective date: 20150227

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 518057 SHENZHEN, GUANGDONG PROVINCE TO: 100085 HAIDIAN, BEIJING

TR01 Transfer of patent right

Effective date of registration: 20150227

Address after: 100085 Beijing city Haidian District No. 33 Xiaoying Road 1 1F06 room

Patentee after: BEIJING ZHIGU TECHNOLOGY SERVICES CO., LTD.

Address before: 518057 Nanshan District, Guangdong high tech Industrial Park, science and Technology Industrial Park, ZTE building, block A, layer 6, layer

Patentee before: ZTE Corporation