CN1808433A - Quick and safe real-time database access method - Google Patents

Quick and safe real-time database access method Download PDF

Info

Publication number
CN1808433A
CN1808433A CN 200610002671 CN200610002671A CN1808433A CN 1808433 A CN1808433 A CN 1808433A CN 200610002671 CN200610002671 CN 200610002671 CN 200610002671 A CN200610002671 A CN 200610002671A CN 1808433 A CN1808433 A CN 1808433A
Authority
CN
China
Prior art keywords
real
data base
time data
record
application program
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.)
Granted
Application number
CN 200610002671
Other languages
Chinese (zh)
Other versions
CN100428232C (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 Helishi System Integration Co ltd
Original Assignee
Beijing Hollysys Co Ltd
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 Beijing Hollysys Co Ltd filed Critical Beijing Hollysys Co Ltd
Priority to CNB2006100026717A priority Critical patent/CN100428232C/en
Publication of CN1808433A publication Critical patent/CN1808433A/en
Application granted granted Critical
Publication of CN100428232C publication Critical patent/CN100428232C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for accessing database in real-time. The invention safely and quickly accesses real-time database by combining sharing sign area with signals, and sets a record in every application program that needs to access real-time database, the record comprises two items: identifier of allowing access real-time database and new real-time database identifier; each one (or each group) record in real-time database is provided with a write signal. When needs to write real-time database, write application program performs write operation on record only if it acquires the write signal of the record to avoid conflicts between each application programs.

Description

A kind of real-time database access method fast and safely
Technical field
The present invention relates to automation control area, relate in particular to real-time database access method based on internal memory.
Background technology
In automation control area, use real-time data base usually based on internal memory.This internal memory real-time data base of all task sharings in the server is to reach the purpose of fast access.Usually adopt following method to guarantee secure access for share and access at present based on the internal memory real-time data base.
First kind, monopolize real-time data base by an application program, all requests to the visit of real-time data base all need to send to this application program, finish actual accessing operation by this application program, and then the result of visit is returned application requested.This method has guaranteed the secure access to real-time data base, but this application program has also become the bottleneck of system, causes the real-time data base access efficiency low.
Second kind, write real-time data field signal lamp and several and read real-time data base signal lamp (reading the real-time data base signal lamp) for each application program that need read real-time data base all is provided with one for real-time data base is provided with one respectively.When needs are write real-time database, write application program and only when obtaining to write real-time data field signal lamp, just begin to write, prevent that writing application program for two writes real-time database simultaneously.When needs are read real-time data base, read application program then only obtain application read just begin to read in the real-time data base signal lamp.In the time of needs online updating real-time data base, the application program of upgrading real-time data base then obtains to write real-time data field signal lamp earlier, what obtain all application programs then reads the real-time data base signal lamp, stop after the operation to all read-writes of real-time data base, and then real-time data base upgraded, upgrading finishes then sends the message that real-time data base upgrades to all application programs.
This method has guaranteed the secure access to real-time data base, and all to read the application program of real-time data base separate, can not interact.But because each read-write real-time data base all needs to carry out the signal lamp operation, carry out system call, efficiency ratio is lower.Simultaneously, because the application operating of writing of writing two different recording has respectively been carried out mutual exclusion, reduced the efficient of write operation.
Summary of the invention
The technical problem to be solved in the present invention provides a kind of access method of real-time data base, can overcome the defective of prior art, visits real-time data base quickly and safely.
In order to solve the problems of the technologies described above, the invention provides a kind of real-time database access method fast and safely, it is characterized in that, be provided with one and share logo area, application program to needs visit real-time data base is provided with record, this record comprises that real-time data base allows access flag and new real-time data base sign, and this method comprises the more process of new database, and this process is divided into following steps:
(a) all application's data storehouses allow access flag to be set to disable access;
(b) after all application programs stop read-write operation to database, upgrade real-time data base;
(c) put the new database sign of all application programs then, and allow access flag to be changed in all application's data storehouses to allow visit.
Further, said method can have following characteristics: this method also comprises the process that connects real-time data base, and this process is divided into following steps:
(i) database of inquiry application allows access flag, if allow, and execution in step (j) then, otherwise execution in step (i) is continued in the time-delay back;
(j) whether the new database sign of the described application program of inspection is set up, if continue to carry out next step, otherwise successful connection finishes;
(k) real-time data base of videoing is again removed the new database sign, finishes.
Further, said method can have following characteristics: each bar in the real-time data base or each group record all are provided with a write operation signal lamp, and this method comprises the process in application program write data storehouse, and this process is divided into following steps:
(o) this application program connects real-time data base, if allow operation this moment, carries out next step;
(p) this application requests is obtained by the signal lamp of write record, if success, execution in step (q), otherwise execution in step (p) is continued in the time-delay back;
(q) this record is carried out write operation, write and finish the signal lamp that discharges this record, finish.
Further, said method can have following characteristics: this method also comprises the process in read data storehouse, and this process is divided into following steps:
(u) connect real-time data base,, carry out next step if allow operation this moment;
(v) read real-time data base.
Further, said method can have following characteristics: each application program that need visit real-time data base is provided with a record.
Adopt the method for the invention, can guarantee to visit real-time data base under the safe situation fast, improve the access efficiency of real-time data base.
Description of drawings
Fig. 1 is an embodiment of the invention write operation process flow diagram;
Fig. 2 is an embodiment of the invention read operation process flow diagram;
Fig. 3 is that the embodiment of the invention connects the real-time data base operational flowchart;
Fig. 4 is that the embodiment of the invention is upgraded operational flowchart.
Embodiment
By analysis, find real-time data base is mainly contained three kinds of operations: reading and writing and renewal to real-time data base visit behavior.Wherein:
Read operation refers to read the data in the real-time data base, can any influence not arranged to real-time data base, but need stop all read operations to real-time data base when real-time data base upgrades;
Write operation refers to the modification to data value in the real-time data base, does not influence the read operation to real-time data base, but to mutual exclusion between the write operation of identical recordings, promptly can not write same record simultaneously.And when upgrading, real-time data base need stop all write operations to real-time data base;
Upgrade operation and be meant renewal, need influence all operations, upgrade the operation that needs before the real-time data base to stop to all read-writes of real-time data base to the internal memory data of reloading to real-time data base to whole real time data database data.
The present invention adopts and shares method that logo area combines with semaphore accessing real-time data base fast and safely.Setting of being done and various operations regular as follows:
1) a shared logo area is set, in this logo area, each need be visited in the application program of real-time data base all a record, and this record comprises two: real-time data base allows access flag and new real-time data base sign.
Wherein, " the real-time data base permission access flag " of each application program is used for this application program of mark and whether allows to visit real-time data base, when only being set to allow visit, this application program just can be carried out read-write operation, this real-time data base allows access flag to be conducted interviews by the real-time data base refresh routine, and other application program then can not be visited;
Whether " the new real-time data base sign " of each application program is used for the mark real-time data base and is updated, if this new real-time data base sign of application queries is set to effectively, then need to carry out the operation of reflection again of real-time data base, this new real-time data base sign is provided with by the real-time data base refresh routine, and is removed after real-time data base is videoed again by each application program.
2) each the bar record (or each group record) in the real-time data base all is provided with a write operation signal lamp.When needs are write real-time database, write the write operation signal lamp that application program has only that record that acquisition will write, just can carry out write operation to this record.
By these two measures, just can finish quick, the safe visit of real-time data base.
Specifically introduce the idiographic flow of application program below respectively to read operation, write operation and the renewal operation of real time data.
Fig. 1 is a write operation process flow diagram of the present invention, and step is as follows:
Step 101, application program connects real-time data base, and next step is carried out in the success back;
Step 102, this application requests is obtained by the signal lamp of write record, if success, execution in step 104, otherwise execution in step 103;
Step 103 is returned step 102 after the time-delay;
Step 104, this application program is carried out write operation to this record, and other application program can not be obtained the write operation signal lamp of this record during this period, after this application program write operation is finished, discharges the signal lamp of this record, finishes.
The write operation lamp is safeguarded by operating system, can effectively avoid clashing between each application program.And by to different record signalization lamp respectively, can mutual exclusion to the write operation of writing two different recording respectively, thereby improved the efficient of write operation.
Fig. 2 is a read operation process flow diagram of the present invention, and step is as follows:
Step 201, application program connects real-time data base, and next step is carried out in the success back;
Step 202, this application program reads real-time data base.
Be for each application program is provided with a read operation lamp in the prior art, and present embodiment is to allow operation flag to substitute with one in the internal memory.Because the function that the read operation lamp is an operating system to be provided need change system model into from line module, system kernel is operated, so the inventive method efficient is higher, operation rate is faster.
Fig. 3 is the process flow diagram that the present invention connects the real-time data base operation, and step is as follows:
Step 301, application program arrive first the real-time data base of sharing logo area inquiry application and allow access flag, allow visit if this is masked as, and then execution in step 303, if do not allow, then execution in step 302;
Step 302 is returned step 301 after the time-delay;
Step 303, whether the new real-time data base sign of this Application inspection application is set up, if carry out next step, otherwise finish;
Step 304, the real-time data base of videoing is again removed new real-time data base sign, finishes.
Fig. 4 is that the present invention upgrades operational flowchart, and step is as follows:
When step 401, application program were upgraded operation, the real-time data base of sharing all application programs in the logo area earlier allowed access flag to be set to disable access;
Step 402 waits for that all application programs stop the read-write operation to real-time data base, carry out next step then;
Step 403 is upgraded real-time data base;
Step 404 after renewal is finished, is provided with the new real-time data base sign of all application programs;
Step 405, the real-time data base of all application programs allow access flag to be set to allow visit.
The present invention can also do various conversion on this basis, such as only to every in real-time data base recording setting write operation signal lamp, perhaps, the quiescing when only replacing the read signal lamp and realize upgrading with the sign of sharing logo area all also can reach the purpose of fast reading and writing real-time data base.

Claims (5)

1, a kind of real-time database access method fast and safely, it is characterized in that, be provided with one and share logo area, application program to needs visit real-time data base is provided with record, this record comprises that real-time data base allows access flag and new real-time data base sign, this method comprises the more process of new database, and this process is divided into following steps:
(a) all application's data storehouses allow access flag to be set to disable access;
(b) after all application programs stop read-write operation to database, upgrade real-time data base;
(c) put the new database sign of all application programs then, and allow access flag to be changed in all application's data storehouses to allow visit.
2, the method for claim 1 is characterized in that, this method also comprises the process that connects real-time data base, and this process is divided into following steps:
(i) database of inquiry application allows access flag, if allow, and execution in step (j) then, otherwise execution in step (i) is continued in the time-delay back;
(j) whether the new database sign of the described application program of inspection is set up, if continue to carry out next step, otherwise successful connection finishes;
(k) real-time data base of videoing is again removed the new database sign, finishes.
3, method as claimed in claim 1 or 2 is characterized in that, each bar in the real-time data base or each group record all are provided with a write operation signal lamp, and this method comprises the process in application program write data storehouse, and this process is divided into following steps:
(o) this application program connects real-time data base, if allow operation this moment, carries out next step;
(p) this application requests is obtained by the signal lamp of write record, if success, execution in step (q), otherwise execution in step (p) is continued in the time-delay back;
(q) this record is carried out write operation, write and finish the signal lamp that discharges this record, finish.
4, method as claimed in claim 1 or 2 is characterized in that, this method also comprises the process in read data storehouse, and this process is divided into following steps:
(u) connect real-time data base,, carry out next step if allow operation this moment;
(v) read real-time data base.
5, the method for claim 1 is characterized in that, is each application program that need visit real-time data base is provided with a record.
CNB2006100026717A 2006-01-26 2006-01-26 Quick and safe real-time database access method Active CN100428232C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100026717A CN100428232C (en) 2006-01-26 2006-01-26 Quick and safe real-time database access method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100026717A CN100428232C (en) 2006-01-26 2006-01-26 Quick and safe real-time database access method

Publications (2)

Publication Number Publication Date
CN1808433A true CN1808433A (en) 2006-07-26
CN100428232C CN100428232C (en) 2008-10-22

Family

ID=36840332

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100026717A Active CN100428232C (en) 2006-01-26 2006-01-26 Quick and safe real-time database access method

Country Status (1)

Country Link
CN (1) CN100428232C (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706815B (en) * 2009-12-03 2012-06-27 北京和利时系统工程有限公司 Database equipment and system
CN101261639B (en) * 2007-03-08 2012-12-12 Sap股份公司 Sharing of database objects
CN102968485A (en) * 2012-11-26 2013-03-13 国电南瑞科技股份有限公司 Method for displaying real-time database menu item based on virtual domain
CN104932925A (en) * 2015-07-06 2015-09-23 许继集团有限公司 Power grid monitoring system realtime database update method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4648036A (en) * 1985-03-06 1987-03-03 At&T Bell Laboratories Method for controlling query and update processing in a database system
JP3593366B2 (en) * 1994-09-19 2004-11-24 株式会社日立製作所 Database management method
CN100371931C (en) * 2003-08-13 2008-02-27 华为技术有限公司 Method for realizing quick-accessing database

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101261639B (en) * 2007-03-08 2012-12-12 Sap股份公司 Sharing of database objects
CN101706815B (en) * 2009-12-03 2012-06-27 北京和利时系统工程有限公司 Database equipment and system
CN102968485A (en) * 2012-11-26 2013-03-13 国电南瑞科技股份有限公司 Method for displaying real-time database menu item based on virtual domain
CN102968485B (en) * 2012-11-26 2016-08-10 国电南瑞科技股份有限公司 A kind of real-time data base menu item methods of exhibiting based on virtual Domain
CN104932925A (en) * 2015-07-06 2015-09-23 许继集团有限公司 Power grid monitoring system realtime database update method
CN104932925B (en) * 2015-07-06 2018-08-03 许继集团有限公司 A kind of grid monitoring system real-time database update method

Also Published As

Publication number Publication date
CN100428232C (en) 2008-10-22

Similar Documents

Publication Publication Date Title
CN1222951C (en) Real-time processing method for flash storage
CN100347692C (en) Implementing method of virtual intelligent controller in SAN system
CN1477518A (en) System for handling file name of file system filter driver and its method
CN101046821A (en) Generic database manipulator
CN101042703A (en) Method for managing metadata of file system using dbms
CN1832489A (en) Method for accessing object magnetic dish and system for extensing disk content
CN1829964A (en) A method, apparatus and computer program for processing a queue of messages
CN1448867A (en) Method for accessing database system uniformly
CN1790302A (en) Data processing system, access control method, and access control device
CN1858710A (en) Method and system for synchronizing data
CN109857566B (en) Resource locking method for memory read-write process
CN1361489A (en) Automatic circular daily record information storing method and system
CN1920796A (en) Cache method and cache system for storing file's data in memory blocks
WO2023226314A1 (en) Application cache-scalable processing method and apparatus, device and medium
CN1808433A (en) Quick and safe real-time database access method
CN1828550A (en) RAM accessing information real-time capturing device and method
CN1896972A (en) Method and device for converting virtual address, reading and writing high-speed buffer memory
CN101075220A (en) Simulator and method for bus arbitraction
CN1862542A (en) Method of shared object attribute
CN1684049A (en) Information storage apparatus, information storage method and information storage processing program product
CN1295600C (en) Windows program abnormality capturing and positioning method
CN1855854A (en) Data cache system and method
CN1664791A (en) Virtual storing model and method thereof
CN1152330C (en) Maintain method for remote node to read local memory and its application device
CN1946035A (en) Method for managing net element data configuration and net element

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
TR01 Transfer of patent right

Effective date of registration: 20211122

Address after: 100176 room 3412, floor 4, building 3, yard 2, Desheng Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing

Patentee after: Beijing Helishi system integration Co.,Ltd.

Address before: 100096, No. 10, building materials Road, Haidian District, Beijing, Xisanqi

Patentee before: BEIJING HOLLYSYS Co.,Ltd.

TR01 Transfer of patent right